| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "zc/zc_sys.h" | ||
| 2 | |||
| 3 | #include "allegro/gfx.h" | ||
| 4 | #include "allegro/gui.h" | ||
| 5 | #include "allegro/inline/draw.inl" | ||
| 6 | #include "allegro5/joystick.h" | ||
| 7 | #include "base/files.h" | ||
| 8 | #include "base/render.h" | ||
| 9 | #include "base/zdefs.h" | ||
| 10 | #include "zalleg/zalleg.h" | ||
| 11 | #include "base/qrs.h" | ||
| 12 | #include "base/dmap.h" | ||
| 13 | #include <functional> | ||
| 14 | #include <queue> | ||
| 15 | #include <stdio.h> | ||
| 16 | #include <stdlib.h> | ||
| 17 | #include <cstring> | ||
| 18 | #include <math.h> | ||
| 19 | #include <map> | ||
| 20 | #include <filesystem> | ||
| 21 | #include <ctype.h> | ||
| 22 | #include <sstream> | ||
| 23 | #include "base/version.h" | ||
| 24 | #include "base/zc_alleg.h" | ||
| 25 | #include "gamedata.h" | ||
| 26 | #include "zc/frame_timings.h" | ||
| 27 | #include "zc/replay_upload.h" | ||
| 28 | #include "zc/zasm_pipeline.h" | ||
| 29 | #include "zc/zc_init.h" | ||
| 30 | #include "init.h" | ||
| 31 | #include "zc/replay.h" | ||
| 32 | #include "zc/cheats.h" | ||
| 33 | #include "zc/render.h" | ||
| 34 | #include "base/zc_math.h" | ||
| 35 | #include "base/zapp.h" | ||
| 36 | #include "dialog/cheatkeys.h" | ||
| 37 | #include "metadata/metadata.h" | ||
| 38 | #include "zc/zelda.h" | ||
| 39 | #include "zc/saves.h" | ||
| 40 | #include "tiles.h" | ||
| 41 | #include "base/colors.h" | ||
| 42 | #include "pal.h" | ||
| 43 | #include "base/zsys.h" | ||
| 44 | #include "base/qst.h" | ||
| 45 | #include "zc/zc_sys.h" | ||
| 46 | #include "play_midi.h" | ||
| 47 | #include "gui/jwin_a5.h" | ||
| 48 | #include "base/jwinfsel.h" | ||
| 49 | #include "base/gui.h" | ||
| 50 | #include "midi.h" | ||
| 51 | #include "subscr.h" | ||
| 52 | #include "zc/maps.h" | ||
| 53 | #include "sprite.h" | ||
| 54 | #include "zc/guys.h" | ||
| 55 | #include "zc/hero.h" | ||
| 56 | #include "zc/title.h" | ||
| 57 | #include "particles.h" | ||
| 58 | #include "sound/zcmusic.h" | ||
| 59 | #include "zc/ffscript.h" | ||
| 60 | #include "dialog/info.h" | ||
| 61 | #include "dialog/alert.h" | ||
| 62 | #include "zc/combos.h" | ||
| 63 | #include "zc/jit.h" | ||
| 64 | #include "zc/zc_subscr.h" | ||
| 65 | #include <fmt/format.h> | ||
| 66 | #include "zconsole/ConsoleLogger.h" | ||
| 67 | #include "zinfo.h" | ||
| 68 | #include "base/misctypes.h" | ||
| 69 | #include "music_playback.h" | ||
| 70 | #include "base/new_menu.h" | ||
| 71 | #include "base/files.h" | ||
| 72 | #include "iter.h" | ||
| 73 | |||
| 74 | #ifdef __EMSCRIPTEN__ | ||
| 75 | #include "base/emscripten_utils.h" | ||
| 76 | #endif | ||
| 77 | |||
| 78 | using namespace std::chrono_literals; | ||
| 79 | |||
| 80 | extern bool Playing; | ||
| 81 | int32_t sfx_voice[WAV_COUNT]; | ||
| 82 | int32_t d_stringloader(int32_t msg,DIALOG *d,int32_t c); | ||
| 83 | int32_t d_midilist_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 84 | |||
| 85 | static ALLEGRO_JOYSTICK* gamepad_dlg_cur_joystick; | ||
| 86 | static int32_t d_joylist_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 87 | |||
| 88 | extern byte monochrome_console; | ||
| 89 | |||
| 90 | extern sprite_list guys, items, Ewpns, Lwpns, chainlinks, decorations; | ||
| 91 | extern std::string loadlast; | ||
| 92 | extern char *sfx_string[WAV_COUNT]; | ||
| 93 | byte use_dwm_flush; | ||
| 94 | byte use_save_indicator; | ||
| 95 | int32_t paused_midi_pos = 0; | ||
| 96 | byte midi_suspended = 0; | ||
| 97 | byte zc_192b163_warp_compatibility; | ||
| 98 | bool epilepsyFlashReduction; | ||
| 99 | signed char pause_in_background_menu_init = 0; | ||
| 100 | byte pause_in_background = 0; | ||
| 101 | bool is_sys_pal = false; | ||
| 102 | static bool load_control_called_this_frame; | ||
| 103 | extern PALETTE* hw_palette; | ||
| 104 | extern bool update_hw_pal; | ||
| 105 | extern const char* dmaplist(int32_t index, int32_t* list_size); | ||
| 106 | int32_t getnumber(const char *prompt,int32_t initialval); | ||
| 107 | |||
| 108 | extern bool kb_typing_mode; //script only, for disbaling key presses affecting Hero, etc. | ||
| 109 | extern int32_t cheat_modifier_keys[4]; //two options each, default either control and either shift | ||
| 110 | |||
| 111 | #ifdef ALLEGRO_LINUX | ||
| 112 | static const char *samplepath = "samplesoundset/patches.dat"; | ||
| 113 | #endif | ||
| 114 | char qst_files_path[2048]; | ||
| 115 | |||
| 116 | extern TopMenu the_player_menu; | ||
| 117 | #ifdef _MSC_VER | ||
| 118 | #define getcwd _getcwd | ||
| 119 | #endif | ||
| 120 | |||
| 121 | bool rF11(); | ||
| 122 | bool rI(); | ||
| 123 | bool rQ(); | ||
| 124 | bool zc_key_pressed(); | ||
| 125 | |||
| 126 | #ifdef _WIN32 | ||
| 127 | |||
| 128 | // This should only be necessary for MinGW, since it doesn't have a dwmapi.h. Add another #ifdef if you like. | ||
| 129 | extern "C" | ||
| 130 | { | ||
| 131 | typedef HRESULT(WINAPI *t_DwmFlush)(); | ||
| 132 | typedef HRESULT(WINAPI *t_DwmIsCompositionEnabled)(BOOL *pfEnabled); | ||
| 133 | } | ||
| 134 | |||
| 135 | void do_DwmFlush() | ||
| 136 | { | ||
| 137 | static HMODULE shell = LoadLibrary("dwmapi.dll"); | ||
| 138 | |||
| 139 | if(!shell) | ||
| 140 | return; | ||
| 141 | |||
| 142 | static t_DwmFlush flush=reinterpret_cast<t_DwmFlush>(GetProcAddress(shell, "DwmFlush")); | ||
| 143 | static t_DwmIsCompositionEnabled isEnabled=reinterpret_cast<t_DwmIsCompositionEnabled>(GetProcAddress(shell, "DwmIsCompositionEnabled")); | ||
| 144 | |||
| 145 | BOOL enabled; | ||
| 146 | isEnabled(&enabled); | ||
| 147 | |||
| 148 | if(isEnabled) | ||
| 149 | flush(); | ||
| 150 | } | ||
| 151 | |||
| 152 | #endif // _WIN32 | ||
| 153 | |||
| 154 | 323 | void zc_exit(int code) | |
| 155 | { | ||
| 156 | extern CConsoleLoggerEx zscript_coloured_console; | ||
| 157 | |||
| 158 | 323 | set_is_exiting(); | |
| 159 | |||
| 160 |
1/2✓ Branch 0 taken 323 times.
✗ Branch 1 not taken.
|
323 | if (replay_get_mode() == ReplayMode::Record) replay_save(); |
| 161 | 323 | replay_stop(); | |
| 162 | 323 | music_stop(); | |
| 163 | 323 | kill_sfx(); | |
| 164 | |||
| 165 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 308 times.
|
323 | if (get_qr(qr_OLD_SCRIPT_VOLUME)) |
| 166 | { | ||
| 167 | //restore user volume settings | ||
| 168 |
2/2✓ Branch 0 taken 307 times.
✓ Branch 1 taken 1 times.
|
308 | if (FFCore.coreflags & FFCORE_SCRIPTED_MIDI_VOLUME) |
| 169 | { | ||
| 170 | 1 | master_volume(-1, ((int32_t)FFCore.usr_midi_volume)); | |
| 171 | 1 | } | |
| 172 |
2/2✓ Branch 0 taken 307 times.
✓ Branch 1 taken 1 times.
|
308 | if (FFCore.coreflags & FFCORE_SCRIPTED_DIGI_VOLUME) |
| 173 | { | ||
| 174 | 1 | master_volume((int32_t)(FFCore.usr_digi_volume), 1); | |
| 175 | 1 | } | |
| 176 |
2/2✓ Branch 0 taken 307 times.
✓ Branch 1 taken 1 times.
|
308 | if (FFCore.coreflags & FFCORE_SCRIPTED_MUSIC_VOLUME) |
| 177 | { | ||
| 178 | 1 | emusic_volume = (int32_t)FFCore.usr_music_volume; | |
| 179 | 1 | } | |
| 180 |
1/2✓ Branch 0 taken 308 times.
✗ Branch 1 not taken.
|
308 | if (FFCore.coreflags & FFCORE_SCRIPTED_SFX_VOLUME) |
| 181 | { | ||
| 182 | ✗ | sfx_volume = (int32_t)FFCore.usr_sfx_volume; | |
| 183 | ✗ | } | |
| 184 | 308 | } | |
| 185 |
1/2✓ Branch 0 taken 323 times.
✗ Branch 1 not taken.
|
323 | if ( FFCore.coreflags&FFCORE_SCRIPTED_PANSTYLE ) |
| 186 | { | ||
| 187 | ✗ | pan_style = (int32_t)FFCore.usr_panstyle; | |
| 188 | ✗ | } | |
| 189 | 323 | save_game_configs(); | |
| 190 | |||
| 191 | 323 | zscript_coloured_console.kill(); | |
| 192 | 323 | zasm_pipeline_shutdown(); | |
| 193 | 323 | frame_timings_end(); | |
| 194 | 323 | quit_game(); | |
| 195 | |||
| 196 | 323 | Z_message("ZQuest Classic website: https://zquestclassic.com\n"); | |
| 197 | 323 | Z_message("ZQuest Classic docs: https://docs.zquestclassic.com\n"); | |
| 198 | |||
| 199 | 323 | allegro_exit(); | |
| 200 | 323 | exit(code); | |
| 201 | } | ||
| 202 | |||
| 203 | 93594 | bool flash_reduction_enabled(bool check_qr) | |
| 204 | { | ||
| 205 |
4/4✓ Branch 0 taken 88914 times.
✓ Branch 1 taken 4680 times.
✓ Branch 2 taken 87624 times.
✓ Branch 3 taken 92304 times.
|
93594 | return (check_qr && get_qr(qr_EPILEPSY)) || epilepsyFlashReduction || replay_is_debug(); |
| 206 | } | ||
| 207 | |||
| 208 | // Dialogue largening | ||
| 209 | ✗ | void large_dialog(DIALOG *d) | |
| 210 | { | ||
| 211 | ✗ | large_dialog(d, 1.5); | |
| 212 | ✗ | } | |
| 213 | |||
| 214 | ✗ | void large_dialog(DIALOG *d, float RESIZE_AMT) | |
| 215 | { | ||
| 216 | ✗ | if(!d[0].d1) | |
| 217 | { | ||
| 218 | ✗ | d[0].d1 = 1; | |
| 219 | ✗ | int32_t oldwidth = d[0].w; | |
| 220 | ✗ | int32_t oldheight = d[0].h; | |
| 221 | ✗ | int32_t oldx = d[0].x; | |
| 222 | ✗ | int32_t oldy = d[0].y; | |
| 223 | ✗ | d[0].x -= int32_t(d[0].w/RESIZE_AMT); | |
| 224 | ✗ | d[0].y -= int32_t(d[0].h/RESIZE_AMT); | |
| 225 | ✗ | d[0].w = int32_t(d[0].w*RESIZE_AMT); | |
| 226 | ✗ | d[0].h = int32_t(d[0].h*RESIZE_AMT); | |
| 227 | |||
| 228 | ✗ | for(int32_t i=1; d[i].proc !=NULL; i++) | |
| 229 | { | ||
| 230 | // Place elements horizontally | ||
| 231 | ✗ | double xpc = ((double)(d[i].x - oldx) / (double)oldwidth); | |
| 232 | ✗ | d[i].x = int32_t(d[0].x + (xpc*d[0].w)); | |
| 233 | |||
| 234 | ✗ | if(d[i].proc != d_stringloader) | |
| 235 | { | ||
| 236 | ✗ | if(d[i].proc==d_bitmap_proc) | |
| 237 | { | ||
| 238 | ✗ | d[i].w *= 2; | |
| 239 | ✗ | } | |
| 240 | ✗ | else d[i].w = int32_t(d[i].w*RESIZE_AMT); | |
| 241 | ✗ | } | |
| 242 | |||
| 243 | // Place elements vertically | ||
| 244 | ✗ | double ypc = ((double)(d[i].y - oldy) / (double)oldheight); | |
| 245 | ✗ | d[i].y = int32_t(d[0].y + (ypc*d[0].h)); | |
| 246 | |||
| 247 | // Vertically resize elements | ||
| 248 | ✗ | if(d[i].proc == jwin_edit_proc || d[i].proc == jwin_check_proc || d[i].proc == jwin_checkfont_proc) | |
| 249 | { | ||
| 250 | ✗ | d[i].h = int32_t((double)d[i].h*1.5); | |
| 251 | ✗ | } | |
| 252 | ✗ | else if(d[i].proc == jwin_droplist_proc || d[i].proc == d_joylist_proc) | |
| 253 | { | ||
| 254 | ✗ | d[i].y += int32_t((double)d[i].h*0.25); | |
| 255 | ✗ | d[i].h = int32_t((double)d[i].h*1.25); | |
| 256 | ✗ | } | |
| 257 | ✗ | else if(d[i].proc==d_bitmap_proc) | |
| 258 | { | ||
| 259 | ✗ | d[i].h *= 2; | |
| 260 | ✗ | } | |
| 261 | ✗ | else d[i].h = int32_t(d[i].h*RESIZE_AMT); | |
| 262 | |||
| 263 | // Fix frames | ||
| 264 | ✗ | if(d[i].proc == jwin_frame_proc) | |
| 265 | { | ||
| 266 | ✗ | d[i].x++; | |
| 267 | ✗ | d[i].y++; | |
| 268 | ✗ | d[i].w-=4; | |
| 269 | ✗ | d[i].h-=4; | |
| 270 | ✗ | } | |
| 271 | ✗ | } | |
| 272 | ✗ | } | |
| 273 | |||
| 274 | ✗ | for(int32_t i=1; d[i].proc!=NULL; i++) | |
| 275 | { | ||
| 276 | ✗ | if(d[i].proc==jwin_slider_proc) | |
| 277 | ✗ | continue; | |
| 278 | |||
| 279 | // Bigger font | ||
| 280 | ✗ | bool bigfontproc = (d[i].proc != d_midilist_proc && d[i].proc != jwin_droplist_proc && d[i].proc != jwin_abclist_proc && d[i].proc != jwin_list_proc && d[i].proc != d_joylist_proc); | |
| 281 | |||
| 282 | ✗ | if(!d[i].dp2 && bigfontproc) | |
| 283 | { | ||
| 284 | ✗ | d[i].dp2 = get_zc_font(font_lfont_l); | |
| 285 | ✗ | } | |
| 286 | ✗ | else if(!bigfontproc) | |
| 287 | { | ||
| 288 | ✗ | ((ListData *)d[i].dp)->font = &a4fonts[font_lfont_l]; | |
| 289 | ✗ | } | |
| 290 | |||
| 291 | // Make checkboxes work | ||
| 292 | ✗ | if(d[i].proc == jwin_check_proc) | |
| 293 | ✗ | d[i].proc = jwin_checkfont_proc; | |
| 294 | ✗ | else if(d[i].proc == jwin_radio_proc) | |
| 295 | ✗ | d[i].proc = jwin_radiofont_proc; | |
| 296 | ✗ | } | |
| 297 | |||
| 298 | ✗ | jwin_center_dialog(d); | |
| 299 | ✗ | } | |
| 300 | |||
| 301 | static char cfg_sect[] = "zeldadx"; //We need to rename this. | ||
| 302 | static char ctrl_sect[] = "Controls"; | ||
| 303 | static char sfx_sect[] = "Volume"; | ||
| 304 | |||
| 305 | ✗ | int32_t d_dummy_proc(int32_t,DIALOG *,int32_t) | |
| 306 | { | ||
| 307 | ✗ | return D_O_K; | |
| 308 | } | ||
| 309 | |||
| 310 | ✗ | bool is_reserved_key(int c) | |
| 311 | { | ||
| 312 | ✗ | switch(c) | |
| 313 | { | ||
| 314 | case KEY_ESC: | ||
| 315 | ✗ | return true; | |
| 316 | } | ||
| 317 | ✗ | return false; | |
| 318 | ✗ | } | |
| 319 | ✗ | bool is_reserved_keycombo(int c, int modflag) | |
| 320 | { | ||
| 321 | ✗ | if(c==KEY_F4 && (modflag&KB_ALT_FLAG)) | |
| 322 | ✗ | return true; | |
| 323 | ✗ | return false; | |
| 324 | ✗ | } | |
| 325 | ✗ | bool checkcheat(Cheat cheat) | |
| 326 | { | ||
| 327 | ✗ | if(cheatkeys[cheat][0] && zc_readkey(cheatkeys[cheat][0])) | |
| 328 | ✗ | return true; //Main key pressed | |
| 329 | ✗ | if(cheatkeys[cheat][1] && zc_readkey(cheatkeys[cheat][1])) | |
| 330 | ✗ | return true; //Alt key pressed | |
| 331 | ✗ | return false; | |
| 332 | ✗ | } | |
| 333 | 323 | void load_default_cheatkeys() | |
| 334 | { | ||
| 335 | 323 | memset(cheatkeys, 0, sizeof(cheatkeys)); | |
| 336 | 323 | cheatkeys[Cheat::Life][0] = KEY_H; | |
| 337 | 323 | cheatkeys[Cheat::Life][1] = KEY_ASTERISK; | |
| 338 | 323 | cheatkeys[Cheat::Magic][0] = KEY_M; | |
| 339 | 323 | cheatkeys[Cheat::Magic][1] = KEY_SLASH_PAD; | |
| 340 | 323 | cheatkeys[Cheat::Rupies][0] = KEY_R; | |
| 341 | 323 | cheatkeys[Cheat::Bombs][0] = KEY_B; | |
| 342 | 323 | cheatkeys[Cheat::Arrows][0] = KEY_A; | |
| 343 | 323 | cheatkeys[Cheat::Clock][0] = KEY_I; | |
| 344 | 323 | cheatkeys[Cheat::Walls][0] = KEY_F11; | |
| 345 | 323 | cheatkeys[Cheat::Fast][0] = KEY_Q; | |
| 346 | 323 | cheatkeys[Cheat::Light][0] = KEY_L; | |
| 347 | 323 | cheatkeys[Cheat::IgnoreSideView][0] = KEY_V; | |
| 348 | 323 | cheatkeys[Cheat::Kill][0] = KEY_K; | |
| 349 | 323 | cheatkeys[Cheat::GoTo][0] = KEY_G; | |
| 350 | 323 | cheatkeys[Cheat::TrigSecrets][0] = KEY_S; | |
| 351 | 323 | cheatkeys[Cheat::ShowL0][0] = KEY_0; | |
| 352 | 323 | cheatkeys[Cheat::ShowL1][0] = KEY_1; | |
| 353 | 323 | cheatkeys[Cheat::ShowL2][0] = KEY_2; | |
| 354 | 323 | cheatkeys[Cheat::ShowL3][0] = KEY_3; | |
| 355 | 323 | cheatkeys[Cheat::ShowL4][0] = KEY_4; | |
| 356 | 323 | cheatkeys[Cheat::ShowL5][0] = KEY_5; | |
| 357 | 323 | cheatkeys[Cheat::ShowL6][0] = KEY_6; | |
| 358 | 323 | cheatkeys[Cheat::ShowFFC][0] = KEY_7; | |
| 359 | 323 | cheatkeys[Cheat::ShowSprites][0] = KEY_8; | |
| 360 | 323 | cheatkeys[Cheat::ShowWalkability][0] = KEY_W; | |
| 361 | 323 | cheatkeys[Cheat::ShowEffects][0] = KEY_E; | |
| 362 | 323 | cheatkeys[Cheat::ShowOverhead][0] = KEY_O; | |
| 363 | 323 | cheatkeys[Cheat::ShowPushblock][0] = KEY_P; | |
| 364 | 323 | cheatkeys[Cheat::ShowHitbox][0] = KEY_C; | |
| 365 | 323 | cheatkeys[Cheat::ShowFFCScripts][0] = KEY_F; | |
| 366 | 323 | } | |
| 367 | |||
| 368 | static bool loaded_game_configs; | ||
| 369 | |||
| 370 | 323 | void load_game_configs() | |
| 371 | { | ||
| 372 | 323 | loaded_game_configs = true; | |
| 373 | 323 | joystick_index = zc_get_config(ctrl_sect,"joystick_index",0); | |
| 374 | 323 | js_stick_1_x_stick = zc_get_config(ctrl_sect,"js_stick_1_x_stick",0); | |
| 375 | 323 | js_stick_1_x_axis = zc_get_config(ctrl_sect,"js_stick_1_x_axis",0); | |
| 376 | 323 | js_stick_1_x_offset = zc_get_config(ctrl_sect,"js_stick_1_x_offset",0) ? 128 : 0; | |
| 377 | 323 | js_stick_1_y_stick = zc_get_config(ctrl_sect,"js_stick_1_y_stick",0); | |
| 378 | 323 | js_stick_1_y_axis = zc_get_config(ctrl_sect,"js_stick_1_y_axis",1); | |
| 379 | 323 | js_stick_1_y_offset = zc_get_config(ctrl_sect,"js_stick_1_y_offset",0) ? 128 : 0; | |
| 380 | 323 | js_stick_2_x_stick = zc_get_config(ctrl_sect,"js_stick_2_x_stick",1); | |
| 381 | 323 | js_stick_2_x_axis = zc_get_config(ctrl_sect,"js_stick_2_x_axis",0); | |
| 382 | 323 | js_stick_2_x_offset = zc_get_config(ctrl_sect,"js_stick_2_x_offset",0) ? 128 : 0; | |
| 383 | 323 | js_stick_2_y_stick = zc_get_config(ctrl_sect,"js_stick_2_y_stick",1); | |
| 384 | 323 | js_stick_2_y_axis = zc_get_config(ctrl_sect,"js_stick_2_y_axis",1); | |
| 385 | 323 | js_stick_2_y_offset = zc_get_config(ctrl_sect,"js_stick_2_y_offset",0) ? 128 : 0; | |
| 386 | 323 | analog_movement = (zc_get_config(ctrl_sect,"analog_movement",1)); | |
| 387 | |||
| 388 | //cheat modifier keya | ||
| 389 | 323 | cheat_modifier_keys[0] = zc_get_config(ctrl_sect,"key_cheatmod_a1",KEY_ZC_LCONTROL); | |
| 390 | 323 | cheat_modifier_keys[1] = zc_get_config(ctrl_sect,"key_cheatmod_a2",0); | |
| 391 | 323 | cheat_modifier_keys[2] = zc_get_config(ctrl_sect,"key_cheatmod_b1",KEY_ZC_RCONTROL); | |
| 392 | 323 | cheat_modifier_keys[3] = zc_get_config(ctrl_sect,"key_cheatmod_b2",0); | |
| 393 | |||
| 394 | //cheat keys | ||
| 395 | 323 | load_default_cheatkeys(); | |
| 396 | char buf[256]; | ||
| 397 |
2/2✓ Branch 0 taken 323 times.
✓ Branch 1 taken 11628 times.
|
11951 | for(size_t q = 1; q < Cheat::Last; ++q) |
| 398 | { | ||
| 399 |
1/2✓ Branch 0 taken 11628 times.
✗ Branch 1 not taken.
|
11628 | if(!bindable_cheat((Cheat)q)) continue; |
| 400 | 11628 | std::string cheatname = cheat_to_string((Cheat)q); | |
| 401 |
1/2✓ Branch 0 taken 11628 times.
✗ Branch 1 not taken.
|
11628 | util::lowerstr(cheatname); |
| 402 | 11628 | sprintf(buf, "key_cheat_%s_main", cheatname.c_str()); | |
| 403 |
1/2✓ Branch 0 taken 11628 times.
✗ Branch 1 not taken.
|
11628 | cheatkeys[q][0] = zc_get_config(ctrl_sect,buf,cheatkeys[q][0]); |
| 404 | 11628 | sprintf(buf, "key_cheat_%s_alt", cheatname.c_str()); | |
| 405 |
1/2✓ Branch 0 taken 11628 times.
✗ Branch 1 not taken.
|
11628 | cheatkeys[q][1] = zc_get_config(ctrl_sect,buf,cheatkeys[q][1]); |
| 406 | 11628 | } | |
| 407 | |||
| 408 |
1/2✓ Branch 0 taken 323 times.
✗ Branch 1 not taken.
|
323 | if((uint32_t)joystick_index >= MAX_JOYSTICKS) |
| 409 | ✗ | joystick_index = 0; | |
| 410 | |||
| 411 | 323 | Akey = zc_get_config(ctrl_sect,"key_a",KEY_Z); | |
| 412 | 323 | Bkey = zc_get_config(ctrl_sect,"key_b",KEY_X); | |
| 413 | 323 | Skey = zc_get_config(ctrl_sect,"key_s",KEY_ENTER); | |
| 414 | 323 | Lkey = zc_get_config(ctrl_sect,"key_l",KEY_Q); | |
| 415 | 323 | Rkey = zc_get_config(ctrl_sect,"key_r",KEY_W); | |
| 416 | 323 | Pkey = zc_get_config(ctrl_sect,"key_p",KEY_SPACE); | |
| 417 | 323 | Exkey1 = zc_get_config(ctrl_sect,"key_ex1",KEY_A); | |
| 418 | 323 | Exkey2 = zc_get_config(ctrl_sect,"key_ex2",KEY_S); | |
| 419 | 323 | Exkey3 = zc_get_config(ctrl_sect,"key_ex3",KEY_D); | |
| 420 | 323 | Exkey4 = zc_get_config(ctrl_sect,"key_ex4",KEY_C); | |
| 421 | |||
| 422 | 323 | DUkey = zc_get_config(ctrl_sect,"key_up", KEY_UP); | |
| 423 | 323 | DDkey = zc_get_config(ctrl_sect,"key_down", KEY_DOWN); | |
| 424 | 323 | DLkey = zc_get_config(ctrl_sect,"key_left", KEY_LEFT); | |
| 425 | 323 | DRkey = zc_get_config(ctrl_sect,"key_right",KEY_RIGHT); | |
| 426 | |||
| 427 | 323 | Abtn = zc_get_config(ctrl_sect,"btn_a",2); | |
| 428 | 323 | Bbtn = zc_get_config(ctrl_sect,"btn_b",1); | |
| 429 | 323 | Sbtn = zc_get_config(ctrl_sect,"btn_s",10); | |
| 430 | 323 | Mbtn = zc_get_config(ctrl_sect,"btn_m",9); | |
| 431 | 323 | Lbtn = zc_get_config(ctrl_sect,"btn_l",5); | |
| 432 | 323 | Rbtn = zc_get_config(ctrl_sect,"btn_r",6); | |
| 433 | 323 | Pbtn = zc_get_config(ctrl_sect,"btn_p",12); | |
| 434 | 323 | Exbtn1 = zc_get_config(ctrl_sect,"btn_ex1",7); | |
| 435 | 323 | Exbtn2 = zc_get_config(ctrl_sect,"btn_ex2",8); | |
| 436 | 323 | Exbtn3 = zc_get_config(ctrl_sect,"btn_ex3",4); | |
| 437 | 323 | Exbtn4 = zc_get_config(ctrl_sect,"btn_ex4",3); | |
| 438 | |||
| 439 | 323 | DUbtn = zc_get_config(ctrl_sect,"btn_up",13); | |
| 440 | 323 | DDbtn = zc_get_config(ctrl_sect,"btn_down",14); | |
| 441 | 323 | DLbtn = zc_get_config(ctrl_sect,"btn_left",15); | |
| 442 | 323 | DRbtn = zc_get_config(ctrl_sect,"btn_right",16); | |
| 443 | |||
| 444 | 323 | epilepsyFlashReduction = zc_get_config(cfg_sect,"epilepsy_flash_reduction",0); | |
| 445 | |||
| 446 | 323 | midi_volume = zc_get_config(sfx_sect,"midi",255); | |
| 447 | 323 | sfx_volume = zc_get_config(sfx_sect,"sfx",255); | |
| 448 | 323 | emusic_volume = zc_get_config(sfx_sect,"emusic",255); | |
| 449 | 323 | pan_style = zc_get_config(sfx_sect,"pan",1); | |
| 450 | 323 | volkeys = zc_get_config(sfx_sect,"volkeys",0)!=0; | |
| 451 | 323 | zc_vsync = zc_get_config(cfg_sect,"vsync",0); | |
| 452 | 323 | Throttlefps = zc_get_config(cfg_sect,"throttlefps",1)!=0; | |
| 453 | 323 | Maxfps = zc_get_config(cfg_sect,"maxfps",0); | |
| 454 | 323 | TransLayers = zc_get_config(cfg_sect,"translayers",1)!=0; | |
| 455 | 323 | SnapshotFormat = zc_get_config(cfg_sect,"snapshot_format",3); | |
| 456 | 323 | ShowBottomPixels = zc_get_config(cfg_sect,"bottom_8_px",0); | |
| 457 | 323 | SnapshotScale = zc_get_config(cfg_sect,"snapshot_scale",2); | |
| 458 | 323 | NameEntryMode = zc_get_config(cfg_sect,"name_entry_mode",0); | |
| 459 | #ifdef __EMSCRIPTEN__ | ||
| 460 | if (em_is_mobile()) NameEntryMode = 2; | ||
| 461 | #endif | ||
| 462 | 323 | ShowFPS = zc_get_config(cfg_sect,"showfps",0)!=0; | |
| 463 | 323 | ShowGameTime = zc_get_config(cfg_sect,"showtime",0); | |
| 464 | 323 | NESquit = zc_get_config(cfg_sect,"fastquit",0)!=0; | |
| 465 | 323 | ClickToFreeze = zc_get_config(cfg_sect,"clicktofreeze",1)!=0; | |
| 466 | 323 | abc_patternmatch = zc_get_config(cfg_sect, "lister_pattern_matching", 1); | |
| 467 | 323 | pause_in_background = zc_get_config(cfg_sect, "pause_in_background", 0); | |
| 468 | |||
| 469 | 323 | window_width = resx = zc_get_config(cfg_sect,"window_width",-1); | |
| 470 | 323 | window_height = resy = zc_get_config(cfg_sect,"window_height",-1); | |
| 471 | 323 | SaveDragResize = zc_get_config(cfg_sect,"save_drag_resize",0)!=0; | |
| 472 | 323 | DragAspect = zc_get_config(cfg_sect,"drag_aspect",0)!=0; | |
| 473 | 323 | SaveWinPos = zc_get_config(cfg_sect,"save_window_position",0)!=0; | |
| 474 | 323 | scaleForceInteger = zc_get_config("zeldadx","scaling_force_integer",1)!=0; | |
| 475 | 323 | stretchGame = zc_get_config("zeldadx","stretch_game_area",0)!=0; | |
| 476 | |||
| 477 | 323 | loadlast = zc_get_config(cfg_sect,"load_last_path",""); | |
| 478 | |||
| 479 | 323 | fullscreen = zc_get_config(cfg_sect,"fullscreen",0); | |
| 480 | |||
| 481 | 323 | info_opacity = zc_get_config("zc","debug_info_opacity",255); | |
| 482 | #ifdef _WIN32 | ||
| 483 | console_enabled = (byte) zc_get_config("CONSOLE", "enabled", 0); | ||
| 484 | //use_win7_keyboard_fix = (byte) zc_get_config(cfg_sect,"use_win7_key_fix",0); | ||
| 485 | use_win32_proc = (byte) zc_get_config(cfg_sect,"zc_win_proc_fix",0); //buggy | ||
| 486 | |||
| 487 | // This one's for Aero | ||
| 488 | use_dwm_flush = (byte) zc_get_config("zeldadx","use_dwm_flush",0); | ||
| 489 | |||
| 490 | monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0); | ||
| 491 | #else //UNIX | ||
| 492 | 323 | console_enabled = (byte) zc_get_config("CONSOLE", "enabled", 0); | |
| 493 | 323 | monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0); | |
| 494 | #endif | ||
| 495 | 323 | clearConsoleOnLoad = zc_get_config("CONSOLE","clear_console_on_load",1)!=0; | |
| 496 | 323 | clearConsoleOnReload = zc_get_config("CONSOLE","clear_console_on_reload",0)!=0; | |
| 497 | |||
| 498 | 323 | strcpy(qstdir,zc_get_config(cfg_sect,"quest_dir","quests")); | |
| 499 | 323 | strcpy(qstpath,qstdir); //qstpath is the local (for this run of ZC) quest path, qstdir is the universal quest dir. | |
| 500 | 323 | ss_enable = zc_get_config(cfg_sect,"ss_enable",1) ? 1 : 0; | |
| 501 | 323 | ss_after = vbound(zc_get_config(cfg_sect,"ss_after",14), 0, 14); | |
| 502 | 323 | ss_speed = vbound(zc_get_config(cfg_sect,"ss_speed",2), 0, 6); | |
| 503 | 323 | ss_density = vbound(zc_get_config(cfg_sect,"ss_density",3), 0, 6); | |
| 504 | 323 | heart_beep = zc_get_config(cfg_sect,"heart_beep",0)!=0; | |
| 505 | //gui_colorset = zc_get_config(cfg_sect,"gui_colorset",0); | ||
| 506 | 323 | sfxdat = zc_get_config(cfg_sect,"use_sfx_dat",1); // TODO: sfxdat is always set to 1 for titlescreen... and 0 in readsfx... so this cfg is pointless, remove? | |
| 507 | 323 | fullscreen = zc_get_config(cfg_sect,"fullscreen",0); | |
| 508 | 323 | use_save_indicator = zc_get_config(cfg_sect,"save_indicator",0); | |
| 509 | 323 | zc_192b163_warp_compatibility = zc_get_config(cfg_sect,"zc_192b163_warp_compatibility",0); | |
| 510 | 323 | SkipTitle = zc_get_config(cfg_sect,"skip_title",0); | |
| 511 | 323 | } | |
| 512 | |||
| 513 | ✗ | void save_control_configs(bool kb) | |
| 514 | { | ||
| 515 | ✗ | if(kb) | |
| 516 | { | ||
| 517 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_a1",cheat_modifier_keys[0]); | |
| 518 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_a2",cheat_modifier_keys[1]); | |
| 519 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_b1",cheat_modifier_keys[2]); | |
| 520 | ✗ | zc_set_config(ctrl_sect,"key_cheatmod_b2",cheat_modifier_keys[3]); | |
| 521 | |||
| 522 | ✗ | if (!replay_is_replaying()) | |
| 523 | { | ||
| 524 | ✗ | zc_set_config(ctrl_sect,"key_a",Akey); | |
| 525 | ✗ | zc_set_config(ctrl_sect,"key_b",Bkey); | |
| 526 | ✗ | zc_set_config(ctrl_sect,"key_s",Skey); | |
| 527 | ✗ | zc_set_config(ctrl_sect,"key_l",Lkey); | |
| 528 | ✗ | zc_set_config(ctrl_sect,"key_r",Rkey); | |
| 529 | ✗ | zc_set_config(ctrl_sect,"key_p",Pkey); | |
| 530 | ✗ | zc_set_config(ctrl_sect,"key_ex1",Exkey1); | |
| 531 | ✗ | zc_set_config(ctrl_sect,"key_ex2",Exkey2); | |
| 532 | ✗ | zc_set_config(ctrl_sect,"key_ex3",Exkey3); | |
| 533 | ✗ | zc_set_config(ctrl_sect,"key_ex4",Exkey4); | |
| 534 | ✗ | zc_set_config(ctrl_sect,"key_up", DUkey); | |
| 535 | ✗ | zc_set_config(ctrl_sect,"key_down", DDkey); | |
| 536 | ✗ | zc_set_config(ctrl_sect,"key_left", DLkey); | |
| 537 | ✗ | zc_set_config(ctrl_sect,"key_right",DRkey); | |
| 538 | ✗ | } | |
| 539 | ✗ | } | |
| 540 | else | ||
| 541 | { | ||
| 542 | ✗ | zc_set_config(ctrl_sect,"joystick_index",joystick_index); | |
| 543 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_stick",js_stick_1_x_stick); | |
| 544 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_axis",js_stick_1_x_axis); | |
| 545 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_x_offset",js_stick_1_x_offset ? 1 : 0); | |
| 546 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_stick",js_stick_1_y_stick); | |
| 547 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_axis",js_stick_1_y_axis); | |
| 548 | ✗ | zc_set_config(ctrl_sect,"js_stick_1_y_offset",js_stick_1_y_offset ? 1 : 0); | |
| 549 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_stick",js_stick_2_x_stick); | |
| 550 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_axis",js_stick_2_x_axis); | |
| 551 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_x_offset",js_stick_2_x_offset ? 1 : 0); | |
| 552 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_stick",js_stick_2_y_stick); | |
| 553 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_axis",js_stick_2_y_axis); | |
| 554 | ✗ | zc_set_config(ctrl_sect,"js_stick_2_y_offset",js_stick_2_y_offset ? 1 : 0); | |
| 555 | ✗ | zc_set_config(ctrl_sect,"analog_movement",analog_movement); | |
| 556 | |||
| 557 | ✗ | zc_set_config(ctrl_sect,"btn_a",Abtn); | |
| 558 | ✗ | zc_set_config(ctrl_sect,"btn_b",Bbtn); | |
| 559 | ✗ | zc_set_config(ctrl_sect,"btn_s",Sbtn); | |
| 560 | ✗ | zc_set_config(ctrl_sect,"btn_m",Mbtn); | |
| 561 | ✗ | zc_set_config(ctrl_sect,"btn_l",Lbtn); | |
| 562 | ✗ | zc_set_config(ctrl_sect,"btn_r",Rbtn); | |
| 563 | ✗ | zc_set_config(ctrl_sect,"btn_p",Pbtn); | |
| 564 | ✗ | zc_set_config(ctrl_sect,"btn_ex1",Exbtn1); | |
| 565 | ✗ | zc_set_config(ctrl_sect,"btn_ex2",Exbtn2); | |
| 566 | ✗ | zc_set_config(ctrl_sect,"btn_ex3",Exbtn3); | |
| 567 | ✗ | zc_set_config(ctrl_sect,"btn_ex4",Exbtn4); | |
| 568 | |||
| 569 | ✗ | zc_set_config(ctrl_sect,"btn_up",DUbtn); | |
| 570 | ✗ | zc_set_config(ctrl_sect,"btn_down",DDbtn); | |
| 571 | ✗ | zc_set_config(ctrl_sect,"btn_left",DLbtn); | |
| 572 | ✗ | zc_set_config(ctrl_sect,"btn_right",DRbtn); | |
| 573 | } | ||
| 574 | ✗ | } | |
| 575 | |||
| 576 | ✗ | void save_cheatkeys() | |
| 577 | { | ||
| 578 | char buf[256]; | ||
| 579 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 580 | { | ||
| 581 | ✗ | if(!bindable_cheat((Cheat)q)) continue; | |
| 582 | ✗ | std::string cheatname = cheat_to_string((Cheat)q); | |
| 583 | ✗ | util::lowerstr(cheatname); | |
| 584 | ✗ | sprintf(buf, "key_cheat_%s_main", cheatname.c_str()); | |
| 585 | ✗ | zc_set_config(ctrl_sect,buf,cheatkeys[q][0]); | |
| 586 | ✗ | sprintf(buf, "key_cheat_%s_alt", cheatname.c_str()); | |
| 587 | ✗ | if(cheatkeys[q][1]) | |
| 588 | ✗ | zc_set_config(ctrl_sect,buf,cheatkeys[q][1]); | |
| 589 | ✗ | else zc_set_config(ctrl_sect,buf,(char*)nullptr); | |
| 590 | ✗ | } | |
| 591 | ✗ | } | |
| 592 | |||
| 593 | 323 | void save_game_configs() | |
| 594 | { | ||
| 595 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 323 times.
|
323 | if (!loaded_game_configs) return; |
| 596 | |||
| 597 | 323 | packfile_password(""); | |
| 598 | |||
| 599 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 323 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
323 | if (all_get_display() && !all_get_fullscreen_flag()&& SaveWinPos) |
| 600 | { | ||
| 601 | int o_window_x, o_window_y; | ||
| 602 | ✗ | al_get_window_position(all_get_display(), &o_window_x, &o_window_y); | |
| 603 | ✗ | zc_set_config(cfg_sect,"window_x",o_window_x); | |
| 604 | ✗ | zc_set_config(cfg_sect,"window_y",o_window_y); | |
| 605 | ✗ | } | |
| 606 | |||
| 607 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 323 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
323 | if (all_get_display() && !all_get_fullscreen_flag() && SaveDragResize) |
| 608 | { | ||
| 609 | ✗ | window_width = al_get_display_width(all_get_display()); | |
| 610 | ✗ | window_height = al_get_display_height(all_get_display()); | |
| 611 | ✗ | zc_set_config(cfg_sect,"window_width",window_width); | |
| 612 | ✗ | zc_set_config(cfg_sect,"window_height",window_height); | |
| 613 | ✗ | } | |
| 614 | |||
| 615 | 323 | zc_set_config(cfg_sect,"load_last_path",loadlast.c_str()); | |
| 616 | 323 | zc_set_config(cfg_sect,"use_sfx_dat",sfxdat); | |
| 617 | |||
| 618 | 323 | flush_config_file(); | |
| 619 | #ifdef __EMSCRIPTEN__ | ||
| 620 | em_sync_fs(); | ||
| 621 | #endif | ||
| 622 | 323 | } | |
| 623 | |||
| 624 | //---------------------------------------------------------------- | ||
| 625 | |||
| 626 | // Timers | ||
| 627 | |||
| 628 | 42486 | void fps_callback() | |
| 629 | { | ||
| 630 | 42486 | lastfps=framecnt; | |
| 631 | 42486 | framecnt=0; | |
| 632 | 42486 | } | |
| 633 | |||
| 634 | END_OF_FUNCTION(fps_callback) | ||
| 635 | |||
| 636 | 323 | int32_t Z_init_timers() | |
| 637 | { | ||
| 638 | static bool didit = false; | ||
| 639 | const static char *err_str = "Couldn't allocate timer"; | ||
| 640 | 323 | err_str = err_str; //Unused variable warning | |
| 641 | |||
| 642 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 323 times.
|
323 | if(didit) |
| 643 | ✗ | return 1; | |
| 644 | |||
| 645 | 323 | didit = true; | |
| 646 | |||
| 647 | LOCK_VARIABLE(lastfps); | ||
| 648 | LOCK_VARIABLE(framecnt); | ||
| 649 | LOCK_FUNCTION(fps_callback); | ||
| 650 | |||
| 651 |
1/2✓ Branch 0 taken 323 times.
✗ Branch 1 not taken.
|
323 | if(install_int_ex(fps_callback,SECS_TO_TIMER(1))) |
| 652 | ✗ | return 0; | |
| 653 | |||
| 654 | 323 | return 1; | |
| 655 | 323 | } | |
| 656 | |||
| 657 | 323 | void Z_remove_timers() | |
| 658 | { | ||
| 659 | 323 | remove_int(fps_callback); | |
| 660 | 323 | } | |
| 661 | |||
| 662 | //---------------------------------------------------------------- | ||
| 663 | |||
| 664 | ✗ | void go() | |
| 665 | { | ||
| 666 | ✗ | blit(screen,tmp_scr,scrx,scry,0,0,screen->w,screen->h); | |
| 667 | ✗ | } | |
| 668 | |||
| 669 | ✗ | void comeback() | |
| 670 | { | ||
| 671 | ✗ | blit(tmp_scr,screen,0,0,scrx,scry,screen->w,screen->h); | |
| 672 | ✗ | } | |
| 673 | |||
| 674 | ✗ | void dump_pal(BITMAP *dest) | |
| 675 | { | ||
| 676 | ✗ | for(int32_t i=0; i<256; i++) | |
| 677 | ✗ | rectfill(dest,(i&63)<<2,(i&0xFC0)>>4,((i&63)<<2)+3,((i&0xFC0)>>4)+3,i); | |
| 678 | ✗ | } | |
| 679 | |||
| 680 | //---------------------------------------------------------------- | ||
| 681 | |||
| 682 | int game_mouse_index = ZCM_BLANK; | ||
| 683 | static bool system_mouse = false; | ||
| 684 | 118 | bool sys_mouse() | |
| 685 | { | ||
| 686 | 118 | system_mouse = true; | |
| 687 | 118 | return MouseSprite::set(ZCM_NORMAL); | |
| 688 | } | ||
| 689 | 1698 | bool game_mouse() | |
| 690 | { | ||
| 691 | 1698 | system_mouse = false; | |
| 692 | 1698 | return MouseSprite::set(game_mouse_index); | |
| 693 | } | ||
| 694 | ✗ | void custom_mouse(BITMAP* bmp, int fx, int fy, bool sys_recolor, bool user_scale) | |
| 695 | { | ||
| 696 | ✗ | if(!bmp) | |
| 697 | ✗ | return; | |
| 698 | ✗ | float scale = vbound(zc_get_config("zeldadx","cursor_scale_large",1.5),1.0,5.0); | |
| 699 | ✗ | int scaledw = bmp->w*scale, scaledh = bmp->h*scale; | |
| 700 | ✗ | if(bmp->w == scaledw && bmp->h == scaledh) | |
| 701 | ✗ | user_scale = false; | |
| 702 | ✗ | if(user_scale || sys_recolor) | |
| 703 | { | ||
| 704 | ✗ | if(!user_scale) scale = 1; | |
| 705 | ✗ | BITMAP* tmpbmp = create_bitmap_ex(8,bmp->w*scale,bmp->h*scale); | |
| 706 | ✗ | if(user_scale) | |
| 707 | ✗ | stretch_blit(bmp, tmpbmp, 0, 0, bmp->w, bmp->h, 0, 0, tmpbmp->w, tmpbmp->h); | |
| 708 | else | ||
| 709 | ✗ | blit(bmp, tmpbmp, 0, 0, 0, 0, bmp->w, bmp->h); | |
| 710 | ✗ | if(sys_recolor) | |
| 711 | ✗ | recolor_mouse(tmpbmp); | |
| 712 | ✗ | MouseSprite::assign(ZCM_CUSTOM, tmpbmp, fx*scale, fy*scale); | |
| 713 | ✗ | destroy_bitmap(tmpbmp); | |
| 714 | ✗ | } | |
| 715 | else | ||
| 716 | { | ||
| 717 | ✗ | MouseSprite::assign(ZCM_CUSTOM, bmp, fx, fy); | |
| 718 | } | ||
| 719 | ✗ | } | |
| 720 | |||
| 721 | //Handles converting the mouse sprite from the .dat file | ||
| 722 | ✗ | void recolor_mouse(BITMAP* bmp) | |
| 723 | { | ||
| 724 | ✗ | for(int32_t x = 0; x < bmp->w; ++x) | |
| 725 | { | ||
| 726 | ✗ | for(int32_t y = 0; y < bmp->h; ++y) | |
| 727 | { | ||
| 728 | ✗ | int32_t color = getpixel(bmp, x, y); | |
| 729 | ✗ | switch(color) | |
| 730 | { | ||
| 731 | case dvc(1): | ||
| 732 | ✗ | color = jwin_pal[jcCURSORMISC]; | |
| 733 | ✗ | break; | |
| 734 | case dvc(2): | ||
| 735 | ✗ | color = jwin_pal[jcCURSOROUTLINE]; | |
| 736 | ✗ | break; | |
| 737 | case dvc(3): | ||
| 738 | ✗ | color = jwin_pal[jcCURSORLIGHT]; | |
| 739 | ✗ | break; | |
| 740 | case dvc(5): | ||
| 741 | ✗ | color = jwin_pal[jcCURSORDARK]; | |
| 742 | ✗ | break; | |
| 743 | default: | ||
| 744 | ✗ | continue; | |
| 745 | } | ||
| 746 | ✗ | putpixel(bmp, x, y, color); | |
| 747 | ✗ | } | |
| 748 | ✗ | } | |
| 749 | ✗ | } | |
| 750 | ✗ | void load_mouse() | |
| 751 | { | ||
| 752 | PALETTE pal; | ||
| 753 | ✗ | BITMAP* cursor_bitmap = load_bitmap("assets/cursor.bmp", pal); | |
| 754 | ✗ | if (!cursor_bitmap) | |
| 755 | ✗ | Z_error_fatal("Missing required file %s\n", "assets/cursor.bmp"); | |
| 756 | |||
| 757 | ✗ | enter_sys_pal(); | |
| 758 | ✗ | MouseSprite::set(-1); | |
| 759 | ✗ | float scale = vbound(zc_get_config("zeldadx","cursor_scale_large",1.5),1.0,5.0); | |
| 760 | ✗ | int32_t sz = 16*scale; | |
| 761 | ✗ | for(int32_t j = 0; j < 1; ++j) | |
| 762 | { | ||
| 763 | ✗ | BITMAP* tmpbmp = create_bitmap_ex(8,16,16); | |
| 764 | ✗ | if(zcmouse[j]) | |
| 765 | ✗ | destroy_bitmap(zcmouse[j]); | |
| 766 | ✗ | zcmouse[j] = create_bitmap_ex(8,sz,sz); | |
| 767 | ✗ | clear_bitmap(zcmouse[j]); | |
| 768 | ✗ | clear_bitmap(tmpbmp); | |
| 769 | ✗ | blit(cursor_bitmap,tmpbmp,1,j*17+1,0,0,16,16); | |
| 770 | ✗ | recolor_mouse(tmpbmp); | |
| 771 | ✗ | if(sz!=16) | |
| 772 | ✗ | stretch_blit(tmpbmp, zcmouse[j], 0, 0, 16, 16, 0, 0, sz, sz); | |
| 773 | else | ||
| 774 | ✗ | blit(tmpbmp, zcmouse[j], 0, 0, 0, 0, 16, 16); | |
| 775 | ✗ | destroy_bitmap(tmpbmp); | |
| 776 | ✗ | } | |
| 777 | ✗ | if(!hw_palette) hw_palette = &RAMpal; | |
| 778 | ✗ | zc_set_palette(*hw_palette); | |
| 779 | |||
| 780 | ✗ | BITMAP* blankmouse = create_bitmap_ex(8,16,16); | |
| 781 | ✗ | clear_bitmap(blankmouse); | |
| 782 | |||
| 783 | ✗ | MouseSprite::assign(ZCM_NORMAL, zcmouse[0], 1*scale, 1*scale); | |
| 784 | ✗ | MouseSprite::assign(ZCM_BLANK, blankmouse); | |
| 785 | //Don't assign ZCM_CUSTOM. That'll be handled by scripts. | ||
| 786 | |||
| 787 | //Reload the mouse | ||
| 788 | ✗ | if(system_mouse) | |
| 789 | ✗ | sys_mouse(); | |
| 790 | ✗ | else game_mouse(); | |
| 791 | |||
| 792 | ✗ | destroy_bitmap(blankmouse); | |
| 793 | ✗ | destroy_bitmap(cursor_bitmap); | |
| 794 | ✗ | exit_sys_pal(); | |
| 795 | ✗ | } | |
| 796 | |||
| 797 | // sets the video mode and initializes the palette and mouse sprite | ||
| 798 | 323 | bool game_vid_mode(int32_t mode,int32_t wait) | |
| 799 | { | ||
| 800 |
1/2✓ Branch 0 taken 323 times.
✗ Branch 1 not taken.
|
323 | if (is_headless()) |
| 801 | 323 | return true; | |
| 802 | |||
| 803 | extern int zq_screen_w, zq_screen_h; | ||
| 804 | ✗ | if(set_gfx_mode(mode,resx,resy,zq_screen_w,zq_screen_h)!=0) | |
| 805 | { | ||
| 806 | ✗ | return false; | |
| 807 | } | ||
| 808 | |||
| 809 | ✗ | scrx = (resx-320)>>1; | |
| 810 | ✗ | scry = (resy-240)>>1; | |
| 811 | ✗ | for(int32_t q = 0; q < NUM_ZCMOUSE; ++q) | |
| 812 | ✗ | zcmouse[q] = NULL; | |
| 813 | ✗ | load_mouse(); | |
| 814 | |||
| 815 | ✗ | for(int32_t i=240; i<256; i++) | |
| 816 | ✗ | RAMpal[i]=pal_gui[i]; | |
| 817 | |||
| 818 | ✗ | zc_set_palette(RAMpal); | |
| 819 | ✗ | clear_to_color(screen,BLACK); | |
| 820 | |||
| 821 | ✗ | rest(wait); | |
| 822 | ✗ | return true; | |
| 823 | 323 | } | |
| 824 | |||
| 825 | 331 | void null_quest() | |
| 826 | { | ||
| 827 |
1/2✓ Branch 0 taken 331 times.
✗ Branch 1 not taken.
|
331 | std::string title_assets_path = "modules/classic/title_gfx.dat"; |
| 828 |
2/4✓ Branch 0 taken 331 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 331 times.
|
331 | if (get_last_loaded_qstpath() == title_assets_path) |
| 829 | ✗ | return; | |
| 830 | |||
| 831 | byte skip_flags[4]; | ||
| 832 |
2/2✓ Branch 0 taken 331 times.
✓ Branch 1 taken 8606 times.
|
8937 | for (int i = 0; i < skip_max; i++) |
| 833 |
1/2✓ Branch 0 taken 8606 times.
✗ Branch 1 not taken.
|
8606 | set_bit(skip_flags, i, 1); |
| 834 |
1/2✓ Branch 0 taken 331 times.
✗ Branch 1 not taken.
|
331 | set_bit(skip_flags, skip_tiles, 0); |
| 835 |
1/2✓ Branch 0 taken 331 times.
✗ Branch 1 not taken.
|
331 | set_bit(skip_flags, skip_csets, 0); |
| 836 |
1/2✓ Branch 0 taken 331 times.
✗ Branch 1 not taken.
|
331 | set_bit(skip_flags, skip_misc, 0); // needed for miscsfx (skip this and `tests/replays/demons_inferno/demons_inferno_1_of_2.zplay` fails). |
| 837 |
1/2✓ Branch 0 taken 331 times.
✗ Branch 1 not taken.
|
331 | loadquest(title_assets_path.c_str(), &QHeader, &QMisc, tunes+ZC_MIDI_COUNT, false, skip_flags, 0, false); |
| 838 | 331 | sfxdat = 1; | |
| 839 | // TODO: sfx.dat is ~1.2 MB. Could be better to break that up into individual files and load on demand / not at startup. | ||
| 840 | // TODO: can we cache the tiles/colordata so we don't have to read title_gfx.dat more than once? | ||
| 841 | // colordata is tiny, but tilebuf is huge, so limit that to just what the title screen needs. | ||
| 842 | // Another option: embed this data into the binary (`xxd -i resources/modules/classic/title_gfx.dat > title_gfx.h`) | ||
| 843 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 331 times.
|
331 | } |
| 844 | |||
| 845 | 331 | void init_NES_mode() | |
| 846 | { | ||
| 847 | 331 | null_quest(); | |
| 848 | 331 | } | |
| 849 | |||
| 850 | //---------------------------------------------------------------- | ||
| 851 | |||
| 852 | qword trianglelines[16]= | ||
| 853 | { | ||
| 854 | 0x0000000000000000ULL, | ||
| 855 | 0xFD00000000000000ULL, | ||
| 856 | 0xFDFD000000000000ULL, | ||
| 857 | 0xFDFDFD0000000000ULL, | ||
| 858 | 0xFDFDFDFD00000000ULL, | ||
| 859 | 0xFDFDFDFDFD000000ULL, | ||
| 860 | 0xFDFDFDFDFDFD0000ULL, | ||
| 861 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 862 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 863 | 0x00FDFDFDFDFDFDFDULL, | ||
| 864 | 0x0000FDFDFDFDFDFDULL, | ||
| 865 | 0x000000FDFDFDFDFDULL, | ||
| 866 | 0x00000000FDFDFDFDULL, | ||
| 867 | 0x0000000000FDFDFDULL, | ||
| 868 | 0x000000000000FDFDULL, | ||
| 869 | 0x00000000000000FDULL, | ||
| 870 | }; | ||
| 871 | |||
| 872 | word screen_triangles[29][32]; | ||
| 873 | |||
| 874 | // the ULL suffixes are to prevent this warning: | ||
| 875 | // warning: integer constant is too large for "int32_t" type | ||
| 876 | |||
| 877 | qword triangles[4][16][8]= //[direction][value][line] | ||
| 878 | { | ||
| 879 | { | ||
| 880 | { | ||
| 881 | 0x0000000000000000ULL, | ||
| 882 | 0x0000000000000000ULL, | ||
| 883 | 0x0000000000000000ULL, | ||
| 884 | 0x0000000000000000ULL, | ||
| 885 | 0x0000000000000000ULL, | ||
| 886 | 0x0000000000000000ULL, | ||
| 887 | 0x0000000000000000ULL, | ||
| 888 | 0x0000000000000000ULL | ||
| 889 | }, | ||
| 890 | { | ||
| 891 | 0xFD00000000000000ULL, | ||
| 892 | 0x0000000000000000ULL, | ||
| 893 | 0x0000000000000000ULL, | ||
| 894 | 0x0000000000000000ULL, | ||
| 895 | 0x0000000000000000ULL, | ||
| 896 | 0x0000000000000000ULL, | ||
| 897 | 0x0000000000000000ULL, | ||
| 898 | 0x0000000000000000ULL | ||
| 899 | }, | ||
| 900 | { | ||
| 901 | 0xFDFD000000000000ULL, | ||
| 902 | 0xFD00000000000000ULL, | ||
| 903 | 0x0000000000000000ULL, | ||
| 904 | 0x0000000000000000ULL, | ||
| 905 | 0x0000000000000000ULL, | ||
| 906 | 0x0000000000000000ULL, | ||
| 907 | 0x0000000000000000ULL, | ||
| 908 | 0x0000000000000000ULL | ||
| 909 | }, | ||
| 910 | { | ||
| 911 | 0xFDFDFD0000000000ULL, | ||
| 912 | 0xFDFD000000000000ULL, | ||
| 913 | 0xFD00000000000000ULL, | ||
| 914 | 0x0000000000000000ULL, | ||
| 915 | 0x0000000000000000ULL, | ||
| 916 | 0x0000000000000000ULL, | ||
| 917 | 0x0000000000000000ULL, | ||
| 918 | 0x0000000000000000ULL | ||
| 919 | }, | ||
| 920 | { | ||
| 921 | 0xFDFDFDFD00000000ULL, | ||
| 922 | 0xFDFDFD0000000000ULL, | ||
| 923 | 0xFDFD000000000000ULL, | ||
| 924 | 0xFD00000000000000ULL, | ||
| 925 | 0x0000000000000000ULL, | ||
| 926 | 0x0000000000000000ULL, | ||
| 927 | 0x0000000000000000ULL, | ||
| 928 | 0x0000000000000000ULL | ||
| 929 | }, | ||
| 930 | { | ||
| 931 | 0xFDFDFDFDFD000000ULL, | ||
| 932 | 0xFDFDFDFD00000000ULL, | ||
| 933 | 0xFDFDFD0000000000ULL, | ||
| 934 | 0xFDFD000000000000ULL, | ||
| 935 | 0xFD00000000000000ULL, | ||
| 936 | 0x0000000000000000ULL, | ||
| 937 | 0x0000000000000000ULL, | ||
| 938 | 0x0000000000000000ULL | ||
| 939 | }, | ||
| 940 | { | ||
| 941 | 0xFDFDFDFDFDFD0000ULL, | ||
| 942 | 0xFDFDFDFDFD000000ULL, | ||
| 943 | 0xFDFDFDFD00000000ULL, | ||
| 944 | 0xFDFDFD0000000000ULL, | ||
| 945 | 0xFDFD000000000000ULL, | ||
| 946 | 0xFD00000000000000ULL, | ||
| 947 | 0x0000000000000000ULL, | ||
| 948 | 0x0000000000000000ULL | ||
| 949 | }, | ||
| 950 | { | ||
| 951 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 952 | 0xFDFDFDFDFDFD0000ULL, | ||
| 953 | 0xFDFDFDFDFD000000ULL, | ||
| 954 | 0xFDFDFDFD00000000ULL, | ||
| 955 | 0xFDFDFD0000000000ULL, | ||
| 956 | 0xFDFD000000000000ULL, | ||
| 957 | 0xFD00000000000000ULL, | ||
| 958 | 0x0000000000000000ULL | ||
| 959 | }, | ||
| 960 | { | ||
| 961 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 962 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 963 | 0xFDFDFDFDFDFD0000ULL, | ||
| 964 | 0xFDFDFDFDFD000000ULL, | ||
| 965 | 0xFDFDFDFD00000000ULL, | ||
| 966 | 0xFDFDFD0000000000ULL, | ||
| 967 | 0xFDFD000000000000ULL, | ||
| 968 | 0xFD00000000000000ULL | ||
| 969 | }, | ||
| 970 | { | ||
| 971 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 972 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 973 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 974 | 0xFDFDFDFDFDFD0000ULL, | ||
| 975 | 0xFDFDFDFDFD000000ULL, | ||
| 976 | 0xFDFDFDFD00000000ULL, | ||
| 977 | 0xFDFDFD0000000000ULL, | ||
| 978 | 0xFDFD000000000000ULL | ||
| 979 | }, | ||
| 980 | { | ||
| 981 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 982 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 983 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 984 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 985 | 0xFDFDFDFDFDFD0000ULL, | ||
| 986 | 0xFDFDFDFDFD000000ULL, | ||
| 987 | 0xFDFDFDFD00000000ULL, | ||
| 988 | 0xFDFDFD0000000000ULL | ||
| 989 | }, | ||
| 990 | { | ||
| 991 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 992 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 993 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 994 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 995 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 996 | 0xFDFDFDFDFDFD0000ULL, | ||
| 997 | 0xFDFDFDFDFD000000ULL, | ||
| 998 | 0xFDFDFDFD00000000ULL | ||
| 999 | }, | ||
| 1000 | { | ||
| 1001 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1002 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1003 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1004 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1005 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1006 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1007 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1008 | 0xFDFDFDFDFD000000ULL | ||
| 1009 | }, | ||
| 1010 | { | ||
| 1011 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1012 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1013 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1014 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1015 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1016 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1017 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1018 | 0xFDFDFDFDFDFD0000ULL | ||
| 1019 | }, | ||
| 1020 | { | ||
| 1021 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1022 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1023 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1024 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1025 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1026 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1027 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1028 | 0xFDFDFDFDFDFDFD00ULL | ||
| 1029 | }, | ||
| 1030 | { | ||
| 1031 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1032 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1033 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1034 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1035 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1036 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1037 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1038 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1039 | } | ||
| 1040 | }, | ||
| 1041 | { | ||
| 1042 | { | ||
| 1043 | 0x0000000000000000ULL, | ||
| 1044 | 0x0000000000000000ULL, | ||
| 1045 | 0x0000000000000000ULL, | ||
| 1046 | 0x0000000000000000ULL, | ||
| 1047 | 0x0000000000000000ULL, | ||
| 1048 | 0x0000000000000000ULL, | ||
| 1049 | 0x0000000000000000ULL, | ||
| 1050 | 0x0000000000000000ULL | ||
| 1051 | }, | ||
| 1052 | { | ||
| 1053 | 0x00000000000000FDULL, | ||
| 1054 | 0x0000000000000000ULL, | ||
| 1055 | 0x0000000000000000ULL, | ||
| 1056 | 0x0000000000000000ULL, | ||
| 1057 | 0x0000000000000000ULL, | ||
| 1058 | 0x0000000000000000ULL, | ||
| 1059 | 0x0000000000000000ULL, | ||
| 1060 | 0x0000000000000000ULL | ||
| 1061 | }, | ||
| 1062 | { | ||
| 1063 | 0x000000000000FDFDULL, | ||
| 1064 | 0x00000000000000FDULL, | ||
| 1065 | 0x0000000000000000ULL, | ||
| 1066 | 0x0000000000000000ULL, | ||
| 1067 | 0x0000000000000000ULL, | ||
| 1068 | 0x0000000000000000ULL, | ||
| 1069 | 0x0000000000000000ULL, | ||
| 1070 | 0x0000000000000000ULL | ||
| 1071 | }, | ||
| 1072 | { | ||
| 1073 | 0x0000000000FDFDFDULL, | ||
| 1074 | 0x000000000000FDFDULL, | ||
| 1075 | 0x00000000000000FDULL, | ||
| 1076 | 0x0000000000000000ULL, | ||
| 1077 | 0x0000000000000000ULL, | ||
| 1078 | 0x0000000000000000ULL, | ||
| 1079 | 0x0000000000000000ULL, | ||
| 1080 | 0x0000000000000000ULL | ||
| 1081 | }, | ||
| 1082 | { | ||
| 1083 | 0x00000000FDFDFDFDULL, | ||
| 1084 | 0x0000000000FDFDFDULL, | ||
| 1085 | 0x000000000000FDFDULL, | ||
| 1086 | 0x00000000000000FDULL, | ||
| 1087 | 0x0000000000000000ULL, | ||
| 1088 | 0x0000000000000000ULL, | ||
| 1089 | 0x0000000000000000ULL, | ||
| 1090 | 0x0000000000000000ULL | ||
| 1091 | }, | ||
| 1092 | { | ||
| 1093 | 0x000000FDFDFDFDFDULL, | ||
| 1094 | 0x00000000FDFDFDFDULL, | ||
| 1095 | 0x0000000000FDFDFDULL, | ||
| 1096 | 0x000000000000FDFDULL, | ||
| 1097 | 0x00000000000000FDULL, | ||
| 1098 | 0x0000000000000000ULL, | ||
| 1099 | 0x0000000000000000ULL, | ||
| 1100 | 0x0000000000000000ULL | ||
| 1101 | }, | ||
| 1102 | { | ||
| 1103 | 0x0000FDFDFDFDFDFDULL, | ||
| 1104 | 0x000000FDFDFDFDFDULL, | ||
| 1105 | 0x00000000FDFDFDFDULL, | ||
| 1106 | 0x0000000000FDFDFDULL, | ||
| 1107 | 0x000000000000FDFDULL, | ||
| 1108 | 0x00000000000000FDULL, | ||
| 1109 | 0x0000000000000000ULL, | ||
| 1110 | 0x0000000000000000ULL | ||
| 1111 | }, | ||
| 1112 | { | ||
| 1113 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1114 | 0x0000FDFDFDFDFDFDULL, | ||
| 1115 | 0x000000FDFDFDFDFDULL, | ||
| 1116 | 0x00000000FDFDFDFDULL, | ||
| 1117 | 0x0000000000FDFDFDULL, | ||
| 1118 | 0x000000000000FDFDULL, | ||
| 1119 | 0x00000000000000FDULL, | ||
| 1120 | 0x0000000000000000ULL | ||
| 1121 | }, | ||
| 1122 | { | ||
| 1123 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1124 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1125 | 0x0000FDFDFDFDFDFDULL, | ||
| 1126 | 0x000000FDFDFDFDFDULL, | ||
| 1127 | 0x00000000FDFDFDFDULL, | ||
| 1128 | 0x0000000000FDFDFDULL, | ||
| 1129 | 0x000000000000FDFDULL, | ||
| 1130 | 0x00000000000000FDULL | ||
| 1131 | }, | ||
| 1132 | { | ||
| 1133 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1134 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1135 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1136 | 0x0000FDFDFDFDFDFDULL, | ||
| 1137 | 0x000000FDFDFDFDFDULL, | ||
| 1138 | 0x00000000FDFDFDFDULL, | ||
| 1139 | 0x0000000000FDFDFDULL, | ||
| 1140 | 0x000000000000FDFDULL | ||
| 1141 | }, | ||
| 1142 | { | ||
| 1143 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1144 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1145 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1146 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1147 | 0x0000FDFDFDFDFDFDULL, | ||
| 1148 | 0x000000FDFDFDFDFDULL, | ||
| 1149 | 0x00000000FDFDFDFDULL, | ||
| 1150 | 0x0000000000FDFDFDULL | ||
| 1151 | }, | ||
| 1152 | { | ||
| 1153 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1154 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1155 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1156 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1157 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1158 | 0x0000FDFDFDFDFDFDULL, | ||
| 1159 | 0x000000FDFDFDFDFDULL, | ||
| 1160 | 0x00000000FDFDFDFDULL | ||
| 1161 | }, | ||
| 1162 | { | ||
| 1163 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1164 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1165 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1166 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1167 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1168 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1169 | 0x0000FDFDFDFDFDFDULL, | ||
| 1170 | 0x000000FDFDFDFDFDULL | ||
| 1171 | }, | ||
| 1172 | { | ||
| 1173 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1174 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1175 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1176 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1177 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1178 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1179 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1180 | 0x0000FDFDFDFDFDFDULL | ||
| 1181 | }, | ||
| 1182 | { | ||
| 1183 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1184 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1185 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1186 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1187 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1188 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1189 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1190 | 0x00FDFDFDFDFDFDFDULL | ||
| 1191 | }, | ||
| 1192 | { | ||
| 1193 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1194 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1195 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1196 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1197 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1198 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1199 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1200 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1201 | } | ||
| 1202 | }, | ||
| 1203 | { | ||
| 1204 | { | ||
| 1205 | 0x0000000000000000ULL, | ||
| 1206 | 0x0000000000000000ULL, | ||
| 1207 | 0x0000000000000000ULL, | ||
| 1208 | 0x0000000000000000ULL, | ||
| 1209 | 0x0000000000000000ULL, | ||
| 1210 | 0x0000000000000000ULL, | ||
| 1211 | 0x0000000000000000ULL, | ||
| 1212 | 0x0000000000000000ULL | ||
| 1213 | }, | ||
| 1214 | { | ||
| 1215 | 0x0000000000000000ULL, | ||
| 1216 | 0x0000000000000000ULL, | ||
| 1217 | 0x0000000000000000ULL, | ||
| 1218 | 0x0000000000000000ULL, | ||
| 1219 | 0x0000000000000000ULL, | ||
| 1220 | 0x0000000000000000ULL, | ||
| 1221 | 0x0000000000000000ULL, | ||
| 1222 | 0xFD00000000000000ULL | ||
| 1223 | }, | ||
| 1224 | { | ||
| 1225 | 0x0000000000000000ULL, | ||
| 1226 | 0x0000000000000000ULL, | ||
| 1227 | 0x0000000000000000ULL, | ||
| 1228 | 0x0000000000000000ULL, | ||
| 1229 | 0x0000000000000000ULL, | ||
| 1230 | 0x0000000000000000ULL, | ||
| 1231 | 0xFD00000000000000ULL, | ||
| 1232 | 0xFDFD000000000000ULL | ||
| 1233 | }, | ||
| 1234 | { | ||
| 1235 | 0x0000000000000000ULL, | ||
| 1236 | 0x0000000000000000ULL, | ||
| 1237 | 0x0000000000000000ULL, | ||
| 1238 | 0x0000000000000000ULL, | ||
| 1239 | 0x0000000000000000ULL, | ||
| 1240 | 0xFD00000000000000ULL, | ||
| 1241 | 0xFDFD000000000000ULL, | ||
| 1242 | 0xFDFDFD0000000000ULL | ||
| 1243 | }, | ||
| 1244 | { | ||
| 1245 | 0x0000000000000000ULL, | ||
| 1246 | 0x0000000000000000ULL, | ||
| 1247 | 0x0000000000000000ULL, | ||
| 1248 | 0x0000000000000000ULL, | ||
| 1249 | 0xFD00000000000000ULL, | ||
| 1250 | 0xFDFD000000000000ULL, | ||
| 1251 | 0xFDFDFD0000000000ULL, | ||
| 1252 | 0xFDFDFDFD00000000ULL | ||
| 1253 | }, | ||
| 1254 | { | ||
| 1255 | 0x0000000000000000ULL, | ||
| 1256 | 0x0000000000000000ULL, | ||
| 1257 | 0x0000000000000000ULL, | ||
| 1258 | 0xFD00000000000000ULL, | ||
| 1259 | 0xFDFD000000000000ULL, | ||
| 1260 | 0xFDFDFD0000000000ULL, | ||
| 1261 | 0xFDFDFDFD00000000ULL, | ||
| 1262 | 0xFDFDFDFDFD000000ULL | ||
| 1263 | }, | ||
| 1264 | { | ||
| 1265 | 0x0000000000000000ULL, | ||
| 1266 | 0x0000000000000000ULL, | ||
| 1267 | 0xFD00000000000000ULL, | ||
| 1268 | 0xFDFD000000000000ULL, | ||
| 1269 | 0xFDFDFD0000000000ULL, | ||
| 1270 | 0xFDFDFDFD00000000ULL, | ||
| 1271 | 0xFDFDFDFDFD000000ULL, | ||
| 1272 | 0xFDFDFDFDFDFD0000ULL | ||
| 1273 | }, | ||
| 1274 | { | ||
| 1275 | 0x0000000000000000ULL, | ||
| 1276 | 0xFD00000000000000ULL, | ||
| 1277 | 0xFDFD000000000000ULL, | ||
| 1278 | 0xFDFDFD0000000000ULL, | ||
| 1279 | 0xFDFDFDFD00000000ULL, | ||
| 1280 | 0xFDFDFDFDFD000000ULL, | ||
| 1281 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1282 | 0xFDFDFDFDFDFDFD00ULL | ||
| 1283 | }, | ||
| 1284 | { | ||
| 1285 | 0xFD00000000000000ULL, | ||
| 1286 | 0xFDFD000000000000ULL, | ||
| 1287 | 0xFDFDFD0000000000ULL, | ||
| 1288 | 0xFDFDFDFD00000000ULL, | ||
| 1289 | 0xFDFDFDFDFD000000ULL, | ||
| 1290 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1291 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1292 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1293 | }, | ||
| 1294 | { | ||
| 1295 | 0xFDFD000000000000ULL, | ||
| 1296 | 0xFDFDFD0000000000ULL, | ||
| 1297 | 0xFDFDFDFD00000000ULL, | ||
| 1298 | 0xFDFDFDFDFD000000ULL, | ||
| 1299 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1300 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1301 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1302 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1303 | }, | ||
| 1304 | { | ||
| 1305 | 0xFDFDFD0000000000ULL, | ||
| 1306 | 0xFDFDFDFD00000000ULL, | ||
| 1307 | 0xFDFDFDFDFD000000ULL, | ||
| 1308 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1309 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1310 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1311 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1312 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1313 | }, | ||
| 1314 | { | ||
| 1315 | 0xFDFDFDFD00000000ULL, | ||
| 1316 | 0xFDFDFDFDFD000000ULL, | ||
| 1317 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1318 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1319 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1320 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1321 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1322 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1323 | }, | ||
| 1324 | { | ||
| 1325 | 0xFDFDFDFDFD000000ULL, | ||
| 1326 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1327 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1328 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1329 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1330 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1331 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1332 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1333 | }, | ||
| 1334 | { | ||
| 1335 | 0xFDFDFDFDFDFD0000ULL, | ||
| 1336 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1337 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1338 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1339 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1340 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1341 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1342 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1343 | }, | ||
| 1344 | { | ||
| 1345 | 0xFDFDFDFDFDFDFD00ULL, | ||
| 1346 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1347 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1348 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1349 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1350 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1351 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1352 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1353 | }, | ||
| 1354 | { | ||
| 1355 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1356 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1357 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1358 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1359 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1360 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1361 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1362 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1363 | } | ||
| 1364 | }, | ||
| 1365 | { | ||
| 1366 | { | ||
| 1367 | 0x0000000000000000ULL, | ||
| 1368 | 0x0000000000000000ULL, | ||
| 1369 | 0x0000000000000000ULL, | ||
| 1370 | 0x0000000000000000ULL, | ||
| 1371 | 0x0000000000000000ULL, | ||
| 1372 | 0x0000000000000000ULL, | ||
| 1373 | 0x0000000000000000ULL, | ||
| 1374 | 0x0000000000000000ULL | ||
| 1375 | }, | ||
| 1376 | { | ||
| 1377 | 0x0000000000000000ULL, | ||
| 1378 | 0x0000000000000000ULL, | ||
| 1379 | 0x0000000000000000ULL, | ||
| 1380 | 0x0000000000000000ULL, | ||
| 1381 | 0x0000000000000000ULL, | ||
| 1382 | 0x0000000000000000ULL, | ||
| 1383 | 0x0000000000000000ULL, | ||
| 1384 | 0x00000000000000FDULL | ||
| 1385 | }, | ||
| 1386 | { | ||
| 1387 | 0x0000000000000000ULL, | ||
| 1388 | 0x0000000000000000ULL, | ||
| 1389 | 0x0000000000000000ULL, | ||
| 1390 | 0x0000000000000000ULL, | ||
| 1391 | 0x0000000000000000ULL, | ||
| 1392 | 0x0000000000000000ULL, | ||
| 1393 | 0x00000000000000FDULL, | ||
| 1394 | 0x000000000000FDFDULL | ||
| 1395 | }, | ||
| 1396 | { | ||
| 1397 | 0x0000000000000000ULL, | ||
| 1398 | 0x0000000000000000ULL, | ||
| 1399 | 0x0000000000000000ULL, | ||
| 1400 | 0x0000000000000000ULL, | ||
| 1401 | 0x0000000000000000ULL, | ||
| 1402 | 0x00000000000000FDULL, | ||
| 1403 | 0x000000000000FDFDULL, | ||
| 1404 | 0x0000000000FDFDFDULL | ||
| 1405 | }, | ||
| 1406 | { | ||
| 1407 | 0x0000000000000000ULL, | ||
| 1408 | 0x0000000000000000ULL, | ||
| 1409 | 0x0000000000000000ULL, | ||
| 1410 | 0x0000000000000000ULL, | ||
| 1411 | 0x00000000000000FDULL, | ||
| 1412 | 0x000000000000FDFDULL, | ||
| 1413 | 0x0000000000FDFDFDULL, | ||
| 1414 | 0x00000000FDFDFDFDULL | ||
| 1415 | }, | ||
| 1416 | { | ||
| 1417 | 0x0000000000000000ULL, | ||
| 1418 | 0x0000000000000000ULL, | ||
| 1419 | 0x0000000000000000ULL, | ||
| 1420 | 0x00000000000000FDULL, | ||
| 1421 | 0x000000000000FDFDULL, | ||
| 1422 | 0x0000000000FDFDFDULL, | ||
| 1423 | 0x00000000FDFDFDFDULL, | ||
| 1424 | 0x000000FDFDFDFDFDULL | ||
| 1425 | }, | ||
| 1426 | { | ||
| 1427 | 0x0000000000000000ULL, | ||
| 1428 | 0x0000000000000000ULL, | ||
| 1429 | 0x00000000000000FDULL, | ||
| 1430 | 0x000000000000FDFDULL, | ||
| 1431 | 0x0000000000FDFDFDULL, | ||
| 1432 | 0x00000000FDFDFDFDULL, | ||
| 1433 | 0x000000FDFDFDFDFDULL, | ||
| 1434 | 0x0000FDFDFDFDFDFDULL | ||
| 1435 | }, | ||
| 1436 | { | ||
| 1437 | 0x0000000000000000ULL, | ||
| 1438 | 0x00000000000000FDULL, | ||
| 1439 | 0x000000000000FDFDULL, | ||
| 1440 | 0x0000000000FDFDFDULL, | ||
| 1441 | 0x00000000FDFDFDFDULL, | ||
| 1442 | 0x000000FDFDFDFDFDULL, | ||
| 1443 | 0x0000FDFDFDFDFDFDULL, | ||
| 1444 | 0x00FDFDFDFDFDFDFDULL | ||
| 1445 | }, | ||
| 1446 | { | ||
| 1447 | 0x00000000000000FDULL, | ||
| 1448 | 0x000000000000FDFDULL, | ||
| 1449 | 0x0000000000FDFDFDULL, | ||
| 1450 | 0x00000000FDFDFDFDULL, | ||
| 1451 | 0x000000FDFDFDFDFDULL, | ||
| 1452 | 0x0000FDFDFDFDFDFDULL, | ||
| 1453 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1454 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1455 | }, | ||
| 1456 | { | ||
| 1457 | 0x000000000000FDFDULL, | ||
| 1458 | 0x0000000000FDFDFDULL, | ||
| 1459 | 0x00000000FDFDFDFDULL, | ||
| 1460 | 0x000000FDFDFDFDFDULL, | ||
| 1461 | 0x0000FDFDFDFDFDFDULL, | ||
| 1462 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1463 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1464 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1465 | }, | ||
| 1466 | { | ||
| 1467 | 0x0000000000FDFDFDULL, | ||
| 1468 | 0x00000000FDFDFDFDULL, | ||
| 1469 | 0x000000FDFDFDFDFDULL, | ||
| 1470 | 0x0000FDFDFDFDFDFDULL, | ||
| 1471 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1472 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1473 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1474 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1475 | }, | ||
| 1476 | { | ||
| 1477 | 0x00000000FDFDFDFDULL, | ||
| 1478 | 0x000000FDFDFDFDFDULL, | ||
| 1479 | 0x0000FDFDFDFDFDFDULL, | ||
| 1480 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1481 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1482 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1483 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1484 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1485 | }, | ||
| 1486 | { | ||
| 1487 | 0x000000FDFDFDFDFDULL, | ||
| 1488 | 0x0000FDFDFDFDFDFDULL, | ||
| 1489 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1490 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1491 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1492 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1493 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1494 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1495 | }, | ||
| 1496 | { | ||
| 1497 | 0x0000FDFDFDFDFDFDULL, | ||
| 1498 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1499 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1500 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1501 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1502 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1503 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1504 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1505 | }, | ||
| 1506 | { | ||
| 1507 | 0x00FDFDFDFDFDFDFDULL, | ||
| 1508 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1509 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1510 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1511 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1512 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1513 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1514 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1515 | }, | ||
| 1516 | { | ||
| 1517 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1518 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1519 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1520 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1521 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1522 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1523 | 0xFDFDFDFDFDFDFDFDULL, | ||
| 1524 | 0xFDFDFDFDFDFDFDFDULL | ||
| 1525 | } | ||
| 1526 | } | ||
| 1527 | }; | ||
| 1528 | |||
| 1529 | static bool is_opening_screen; | ||
| 1530 | int32_t black_opening_count=0; | ||
| 1531 | int32_t black_opening_x,black_opening_y; | ||
| 1532 | int32_t black_opening_shape; | ||
| 1533 | |||
| 1534 | 3422 | int32_t choose_opening_shape() | |
| 1535 | { | ||
| 1536 | // First, count how many bits are set | ||
| 1537 | 3422 | int32_t numBits=0; | |
| 1538 | int32_t bitCounter; | ||
| 1539 | |||
| 1540 |
2/2✓ Branch 0 taken 17110 times.
✓ Branch 1 taken 3422 times.
|
20532 | for(int32_t i=0; i<bosMAX; i++) |
| 1541 | { | ||
| 1542 |
2/2✓ Branch 0 taken 13472 times.
✓ Branch 1 taken 3638 times.
|
17110 | if(COOLSCROLL&(1<<i)) |
| 1543 | 3638 | numBits++; | |
| 1544 | 17110 | } | |
| 1545 | |||
| 1546 | // Shouldn't happen... | ||
| 1547 |
1/2✓ Branch 0 taken 3422 times.
✗ Branch 1 not taken.
|
3422 | if(numBits==0) |
| 1548 | ✗ | return bosCIRCLE; | |
| 1549 | |||
| 1550 | // Pick a bit | ||
| 1551 | 3422 | bitCounter=zc_rand()%numBits+1; | |
| 1552 | |||
| 1553 |
2/2✓ Branch 0 taken 4891 times.
✓ Branch 1 taken 26 times.
|
4917 | for(int32_t i=0; i<bosMAX; i++) |
| 1554 | { | ||
| 1555 | // If this bit is set, decrement the bit counter | ||
| 1556 |
2/2✓ Branch 0 taken 1339 times.
✓ Branch 1 taken 3552 times.
|
4891 | if(COOLSCROLL&(1<<i)) |
| 1557 | 3552 | bitCounter--; | |
| 1558 | |||
| 1559 | // When the counter hits 0, return a value based on | ||
| 1560 | // which bit it stopped on. | ||
| 1561 | // Reminder: enum {bosCIRCLE=0, bosOVAL, bosTRIANGLE, bosSMAS, bosFADEBLACK, bosMAX}; | ||
| 1562 |
2/2✓ Branch 0 taken 3396 times.
✓ Branch 1 taken 1495 times.
|
4891 | if(bitCounter==0) |
| 1563 | 3396 | return i; | |
| 1564 | 1495 | } | |
| 1565 | |||
| 1566 | // Shouldn't be necessary, but the compiler might complain, at least | ||
| 1567 | 26 | return bosCIRCLE; | |
| 1568 | 3422 | } | |
| 1569 | |||
| 1570 | 740 | void close_black_opening(int32_t x, int32_t y, bool wait, int32_t shape) | |
| 1571 | { | ||
| 1572 | 740 | x -= viewport.x; | |
| 1573 | 740 | y -= viewport.y; | |
| 1574 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 730 times.
|
740 | black_opening_shape= (shape>-1 ? shape : choose_opening_shape()); |
| 1575 | |||
| 1576 | 740 | int32_t w=framebuf->w, h=framebuf->h; | |
| 1577 | 740 | int32_t blockrows=h/8, blockcolumns=32; | |
| 1578 | 740 | int32_t xoffset=(x-(w/2))/8, yoffset=(y-(h/2))/8; | |
| 1579 | |||
| 1580 |
2/2✓ Branch 0 taken 20721 times.
✓ Branch 1 taken 740 times.
|
21461 | for(int32_t blockrow=0; blockrow<blockrows; ++blockrow) //30 |
| 1581 | { | ||
| 1582 |
2/2✓ Branch 0 taken 663072 times.
✓ Branch 1 taken 20721 times.
|
683793 | for(int32_t blockcolumn=0; blockcolumn<blockcolumns; ++blockcolumn) //40 |
| 1583 | { | ||
| 1584 |
2/2✓ Branch 0 taken 274113 times.
✓ Branch 1 taken 388959 times.
|
663072 | screen_triangles[blockrow][blockcolumn]=zc_max(abs(int32_t(double(blockcolumns-1)/2-blockcolumn+xoffset)),abs(int32_t(double(blockrows-1)/2-blockrow+yoffset)))|0x0100|((blockrow-yoffset<blockrows/2)?0:0x8000)|((blockcolumn-xoffset<blockcolumns/2)?0x4000:0); |
| 1585 | 663072 | } | |
| 1586 | 20721 | } | |
| 1587 | |||
| 1588 | 740 | black_opening_count = 66; | |
| 1589 | 740 | black_opening_x = x; | |
| 1590 | 740 | black_opening_y = y; | |
| 1591 | 740 | lensclk = 0; | |
| 1592 | //black_opening_shape=(black_opening_shape+1)%bosMAX; | ||
| 1593 | |||
| 1594 | |||
| 1595 |
1/2✓ Branch 0 taken 740 times.
✗ Branch 1 not taken.
|
740 | if(black_opening_shape == bosFADEBLACK) |
| 1596 | { | ||
| 1597 | ✗ | refreshTints(); | |
| 1598 | ✗ | memcpy(tempblackpal, RAMpal, sizeof(RAMpal)); //Store palette in temp palette for fade effect | |
| 1599 | ✗ | } | |
| 1600 |
2/2✓ Branch 0 taken 725 times.
✓ Branch 1 taken 15 times.
|
740 | if(wait) |
| 1601 | { | ||
| 1602 | 15 | FFCore.warpScriptCheck(); | |
| 1603 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 990 times.
|
1005 | for(int32_t i=0; i<66; i++) |
| 1604 | { | ||
| 1605 | 990 | draw_screen(); | |
| 1606 | 990 | advanceframe(true); | |
| 1607 | |||
| 1608 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 990 times.
|
990 | if(Quit) |
| 1609 | { | ||
| 1610 | ✗ | break; | |
| 1611 | } | ||
| 1612 | 990 | } | |
| 1613 | 15 | } | |
| 1614 | 740 | } | |
| 1615 | |||
| 1616 | 2702 | void open_black_opening(int32_t x, int32_t y, bool wait, int32_t shape) | |
| 1617 | { | ||
| 1618 | 2702 | x -= viewport.x; | |
| 1619 | 2702 | y -= viewport.y; | |
| 1620 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 2692 times.
|
2702 | black_opening_shape= (shape>-1 ? shape : choose_opening_shape()); |
| 1621 | |||
| 1622 | 2702 | int32_t w=framebuf->w, h=framebuf->h; | |
| 1623 | 2702 | int32_t blockrows=h/8, blockcolumns=32; | |
| 1624 | 2702 | int32_t xoffset=(x-(w/2))/8, yoffset=(y-(h/2))/8; | |
| 1625 | |||
| 1626 |
2/2✓ Branch 0 taken 75906 times.
✓ Branch 1 taken 2702 times.
|
78608 | for(int32_t blockrow=0; blockrow<blockrows; ++blockrow) //30 |
| 1627 | { | ||
| 1628 |
2/2✓ Branch 0 taken 2428992 times.
✓ Branch 1 taken 75906 times.
|
2504898 | for(int32_t blockcolumn=0; blockcolumn<blockcolumns; ++blockcolumn) //40 |
| 1629 | { | ||
| 1630 |
2/2✓ Branch 0 taken 1201442 times.
✓ Branch 1 taken 1227550 times.
|
2428992 | screen_triangles[blockrow][blockcolumn]=zc_max(abs(int32_t(double(blockcolumns-1)/2-blockcolumn+xoffset)),abs(int32_t(double(blockrows-1)/2-blockrow+yoffset)))|0x0100|((blockrow-yoffset<blockrows/2)?0:0x8000)|((blockcolumn-xoffset<blockcolumns/2)?0x4000:0); |
| 1631 | 2428992 | } | |
| 1632 | 75906 | } | |
| 1633 | |||
| 1634 | 2702 | black_opening_count = -66; | |
| 1635 | 2702 | black_opening_x = x; | |
| 1636 | 2702 | black_opening_y = y; | |
| 1637 | 2702 | lensclk = 0; | |
| 1638 |
1/2✓ Branch 0 taken 2702 times.
✗ Branch 1 not taken.
|
2702 | if(black_opening_shape == bosFADEBLACK) |
| 1639 | { | ||
| 1640 | ✗ | refreshTints(); | |
| 1641 | ✗ | memcpy(tempblackpal, RAMpal, sizeof(RAMpal)); //Store palette in temp palette for fade effect | |
| 1642 | ✗ | } | |
| 1643 |
2/2✓ Branch 0 taken 361 times.
✓ Branch 1 taken 2341 times.
|
2702 | if(wait) |
| 1644 | { | ||
| 1645 | 2341 | FFCore.warpScriptCheck(); | |
| 1646 |
2/2✓ Branch 0 taken 2337 times.
✓ Branch 1 taken 154426 times.
|
156763 | for(int32_t i=0; i<66; i++) |
| 1647 | { | ||
| 1648 | 154426 | draw_screen(); | |
| 1649 | 154426 | advanceframe(true); | |
| 1650 | |||
| 1651 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 154422 times.
|
154426 | if(Quit) |
| 1652 | { | ||
| 1653 | 4 | break; | |
| 1654 | } | ||
| 1655 | 154422 | } | |
| 1656 | 2341 | } | |
| 1657 | 2702 | } | |
| 1658 | |||
| 1659 | 226770 | void black_opening(BITMAP *dest,int32_t x,int32_t y,int32_t a,int32_t max_a) | |
| 1660 | { | ||
| 1661 | 226770 | clear_to_color(tmp_scr,BLACK); | |
| 1662 | 226770 | int32_t w=dest->w, h=dest->h; | |
| 1663 | |||
| 1664 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 9636 times.
✓ Branch 2 taken 10867 times.
✓ Branch 3 taken 20394 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 185873 times.
|
226770 | switch(black_opening_shape) |
| 1665 | { | ||
| 1666 | case bosOVAL: | ||
| 1667 | { | ||
| 1668 | 9636 | double new_w=(w/2)+abs(w/2-x); | |
| 1669 | 9636 | double new_h=(h/2)+abs(h/2-y); | |
| 1670 | 9636 | double b=sqrt(((new_w*new_w)/4)+(new_h*new_h)); | |
| 1671 | 9636 | ellipsefill(tmp_scr,x,y,int32_t(2*a*b/max_a)/8*8,int32_t(a*b/max_a)/8*8,0); | |
| 1672 | 9636 | break; | |
| 1673 | } | ||
| 1674 | |||
| 1675 | case bosTRIANGLE: | ||
| 1676 | { | ||
| 1677 | 10867 | double new_w=(w/2)+abs(w/2-x); | |
| 1678 | 10867 | double new_h=(h/2)+abs(h/2-y); | |
| 1679 | 10867 | double r=a*(new_w*sqrt((double)3)+new_h)/max_a; | |
| 1680 | 10867 | double P2= (PI/2); | |
| 1681 | 10867 | double P23=(2*PI/3); | |
| 1682 | 10867 | double P43=(4*PI/3); | |
| 1683 | 10867 | double Pa= (-4*PI*a/(3*max_a)); | |
| 1684 | 10867 | double angle=P2+Pa; | |
| 1685 | 10867 | double a0=angle; | |
| 1686 | 10867 | double a2=angle+P23; | |
| 1687 | 10867 | double a4=angle+P43; | |
| 1688 | 21734 | triangle(tmp_scr, x+int32_t(zc::math::Cos(a0)*r), y-int32_t(zc::math::Sin(a0)*r), | |
| 1689 | 10867 | x+int32_t(zc::math::Cos(a2)*r), y-int32_t(zc::math::Sin(a2)*r), | |
| 1690 | 10867 | x+int32_t(zc::math::Cos(a4)*r), y-int32_t(zc::math::Sin(a4)*r), | |
| 1691 | 0); | ||
| 1692 | 10867 | break; | |
| 1693 | } | ||
| 1694 | |||
| 1695 | case bosSMAS: | ||
| 1696 | { | ||
| 1697 |
2/2✓ Branch 0 taken 7260 times.
✓ Branch 1 taken 13134 times.
|
20394 | int32_t distance=zc_max(abs(w/2-x),abs(h/2-y))/8; |
| 1698 | |||
| 1699 |
2/2✓ Branch 0 taken 571032 times.
✓ Branch 1 taken 20394 times.
|
591426 | for(int32_t blockrow=0; blockrow<h/8; ++blockrow) //30 |
| 1700 | { | ||
| 1701 |
2/2✓ Branch 0 taken 4568256 times.
✓ Branch 1 taken 571032 times.
|
5139288 | for(int32_t linerow=0; linerow<8; ++linerow) |
| 1702 | { | ||
| 1703 | 4568256 | qword *triangleline=(qword*)(tmp_scr->line[(blockrow*8+linerow)]); | |
| 1704 | |||
| 1705 |
2/2✓ Branch 0 taken 146184192 times.
✓ Branch 1 taken 4568256 times.
|
150752448 | for(int32_t blockcolumn=0; blockcolumn<32; ++blockcolumn) //40 |
| 1706 | { | ||
| 1707 | 438552576 | *triangleline=triangles[(screen_triangles[blockrow][blockcolumn]&0xC000)>>14] | |
| 1708 |
6/6✓ Branch 0 taken 105613064 times.
✓ Branch 1 taken 40571128 times.
✓ Branch 2 taken 96455664 times.
✓ Branch 3 taken 49728528 times.
✓ Branch 4 taken 55884536 times.
✓ Branch 5 taken 40571128 times.
|
146184192 | [zc_min(zc_max((((31+distance)*(max_a-a)/max_a)+((screen_triangles[blockrow][blockcolumn]&0x0FFF)-0x0100)-(15+distance)),0),15)] |
| 1709 | 146184192 | [linerow]; | |
| 1710 | 146184192 | ++triangleline; | |
| 1711 | 146184192 | } | |
| 1712 | 4568256 | } | |
| 1713 | 571032 | } | |
| 1714 | |||
| 1715 | 20394 | break; | |
| 1716 | } | ||
| 1717 | |||
| 1718 | case bosFADEBLACK: | ||
| 1719 | { | ||
| 1720 | ✗ | if(black_opening_count<0) | |
| 1721 | { | ||
| 1722 | ✗ | black_fade(zc_min(-black_opening_count,63)); | |
| 1723 | ✗ | } | |
| 1724 | ✗ | else if(black_opening_count>0) | |
| 1725 | { | ||
| 1726 | ✗ | black_fade(63-zc_max(black_opening_count-3,0)); | |
| 1727 | ✗ | } | |
| 1728 | ✗ | else black_fade(0); | |
| 1729 | ✗ | return; //no blitting from tmp_scr! | |
| 1730 | } | ||
| 1731 | |||
| 1732 | 185873 | case bosCIRCLE: | |
| 1733 | default: | ||
| 1734 | { | ||
| 1735 | 185873 | double new_w=(w/2)+abs(w/2-x); | |
| 1736 | 185873 | double new_h=(h/2)+abs(h/2-y); | |
| 1737 | 185873 | int32_t r=int32_t(sqrt((new_w*new_w)+(new_h*new_h))*a/max_a); | |
| 1738 | //circlefill(tmp_scr,x,y,a<<3,0); | ||
| 1739 | 185873 | circlefill(tmp_scr,x,y,r,0); | |
| 1740 | 185873 | break; | |
| 1741 | } | ||
| 1742 | } | ||
| 1743 | |||
| 1744 | 226770 | masked_blit(tmp_scr,dest,0,0,0,0,320,240); | |
| 1745 | 226770 | } | |
| 1746 | |||
| 1747 | // fadeamnt is 0-63 | ||
| 1748 | ✗ | void black_fade(int32_t fadeamnt) | |
| 1749 | { | ||
| 1750 | ✗ | fadeamnt = _rgb_scale_6[fadeamnt]; | |
| 1751 | ✗ | for(int32_t i=0; i < 0xEF; i++) | |
| 1752 | { | ||
| 1753 | ✗ | RAMpal[i].r = vbound(tempblackpal[i].r-fadeamnt,0,255); | |
| 1754 | ✗ | RAMpal[i].g = vbound(tempblackpal[i].g-fadeamnt,0,255); | |
| 1755 | ✗ | RAMpal[i].b = vbound(tempblackpal[i].b-fadeamnt,0,255); | |
| 1756 | ✗ | } | |
| 1757 | |||
| 1758 | ✗ | refreshpal = true; | |
| 1759 | ✗ | } | |
| 1760 | |||
| 1761 | //---------------------------------------------------------------- | ||
| 1762 | |||
| 1763 | 208658999 | bool item_disabled(int32_t item) //is this item disabled? | |
| 1764 | { | ||
| 1765 |
2/2✓ Branch 0 taken 15091102 times.
✓ Branch 1 taken 193567897 times.
|
208658999 | return (unsigned(item) < MAXITEMS && game->items_off[item] != 0); |
| 1766 | } | ||
| 1767 | |||
| 1768 | 16267224 | bool can_use_item(int32_t item_type, int32_t item) //can Hero use this item? | |
| 1769 | { | ||
| 1770 |
2/2✓ Branch 0 taken 261172 times.
✓ Branch 1 taken 16006052 times.
|
16267224 | if(current_item(item_type, true) >=item) |
| 1771 | { | ||
| 1772 | 261172 | return true; | |
| 1773 | } | ||
| 1774 | |||
| 1775 | 16006052 | return false; | |
| 1776 | 16267224 | } | |
| 1777 | |||
| 1778 | 45770965 | bool has_item(int32_t item_type, int32_t it) //does Hero possess this item? | |
| 1779 | { | ||
| 1780 |
5/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 4628167 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 337472 times.
✓ Branch 6 taken 30509045 times.
✓ Branch 7 taken 10090004 times.
✓ Branch 8 taken 206277 times.
|
45770965 | switch(item_type) |
| 1781 | { | ||
| 1782 | case itype_bomb: | ||
| 1783 | case itype_sbomb: | ||
| 1784 | { | ||
| 1785 | ✗ | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 1786 | |||
| 1787 | ✗ | if(itemid == -1) | |
| 1788 | ✗ | return false; | |
| 1789 | |||
| 1790 | ✗ | return (game->get_item(itemid)); | |
| 1791 | } | ||
| 1792 | |||
| 1793 | case itype_clock: | ||
| 1794 | { | ||
| 1795 | 4628167 | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 1796 | |||
| 1797 |
2/4✓ Branch 0 taken 4628167 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4628167 times.
✗ Branch 3 not taken.
|
4628167 | if(itemid != -1 && (itemsbuf[itemid].flags & item_flag1)) //Active clock |
| 1798 | ✗ | return (game->get_item(itemid)); | |
| 1799 | 4628167 | return Hero.getClock()?1:0; | |
| 1800 | } | ||
| 1801 | |||
| 1802 | case itype_key: | ||
| 1803 | ✗ | return (game->get_keys()>0); | |
| 1804 | |||
| 1805 | case itype_magiccontainer: | ||
| 1806 | ✗ | return (game->get_maxmagic()>=game->get_mp_per_block()); | |
| 1807 | |||
| 1808 | case itype_triforcepiece: //it: -2=any, -1=current level, other=that level | ||
| 1809 | { | ||
| 1810 |
1/3✓ Branch 0 taken 337472 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
337472 | switch(it) |
| 1811 | { | ||
| 1812 | case -2: | ||
| 1813 | { | ||
| 1814 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1815 | { | ||
| 1816 | ✗ | if(game->lvlitems[i]&(1 << li_mcguffin)) | |
| 1817 | { | ||
| 1818 | ✗ | return true; | |
| 1819 | } | ||
| 1820 | ✗ | } | |
| 1821 | |||
| 1822 | ✗ | return false; | |
| 1823 | } | ||
| 1824 | |||
| 1825 | case -1: | ||
| 1826 | ✗ | return (game->lvlitems[dlevel]&(1 << li_mcguffin)); | |
| 1827 | |||
| 1828 | default: | ||
| 1829 |
2/4✓ Branch 0 taken 337472 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 337472 times.
|
337472 | if(it>=0&&it<MAXLEVELS) |
| 1830 | { | ||
| 1831 | 337472 | return (game->lvlitems[it]&(1 << li_mcguffin)); | |
| 1832 | } | ||
| 1833 | |||
| 1834 | ✗ | break; | |
| 1835 | } | ||
| 1836 | |||
| 1837 | ✗ | return 0; | |
| 1838 | } | ||
| 1839 | |||
| 1840 | case itype_map: //it: -2=any, -1=current level, other=that level | ||
| 1841 | { | ||
| 1842 |
2/3✓ Branch 0 taken 541626 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29967419 times.
|
30509045 | switch(it) |
| 1843 | { | ||
| 1844 | case -2: | ||
| 1845 | { | ||
| 1846 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1847 | { | ||
| 1848 | ✗ | if(game->lvlitems[i]&(1 << li_map)) | |
| 1849 | { | ||
| 1850 | ✗ | return true; | |
| 1851 | } | ||
| 1852 | ✗ | } | |
| 1853 | |||
| 1854 | ✗ | return false; | |
| 1855 | } | ||
| 1856 | |||
| 1857 | case -1: | ||
| 1858 | 29967419 | return (game->lvlitems[dlevel]&(1 << li_map))!=0; | |
| 1859 | |||
| 1860 | default: | ||
| 1861 |
2/4✓ Branch 0 taken 541626 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 541626 times.
|
541626 | if(it>=0&&it<MAXLEVELS) |
| 1862 | { | ||
| 1863 | 541626 | return (game->lvlitems[it]&(1 << li_map))!=0; | |
| 1864 | } | ||
| 1865 | |||
| 1866 | ✗ | break; | |
| 1867 | } | ||
| 1868 | |||
| 1869 | ✗ | return 0; | |
| 1870 | } | ||
| 1871 | |||
| 1872 | case itype_compass: //it: -2=any, -1=current level, other=that level | ||
| 1873 | { | ||
| 1874 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 10090004 times.
|
10090004 | switch(it) |
| 1875 | { | ||
| 1876 | case -2: | ||
| 1877 | { | ||
| 1878 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1879 | { | ||
| 1880 | ✗ | if(game->lvlitems[i]&(1 << li_compass)) | |
| 1881 | { | ||
| 1882 | ✗ | return true; | |
| 1883 | } | ||
| 1884 | ✗ | } | |
| 1885 | |||
| 1886 | ✗ | return false; | |
| 1887 | } | ||
| 1888 | |||
| 1889 | case -1: | ||
| 1890 | 10090004 | return (game->lvlitems[dlevel]&(1 << li_compass))!=0; | |
| 1891 | |||
| 1892 | default: | ||
| 1893 | ✗ | if(it>=0&&it<MAXLEVELS) | |
| 1894 | { | ||
| 1895 | ✗ | return (game->lvlitems[it]&(1 << li_compass))!=0; | |
| 1896 | } | ||
| 1897 | |||
| 1898 | ✗ | break; | |
| 1899 | } | ||
| 1900 | ✗ | return 0; | |
| 1901 | } | ||
| 1902 | |||
| 1903 | case itype_bosskey: //it: -2=any, -1=current level, other=that level | ||
| 1904 | { | ||
| 1905 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 206277 times.
|
206277 | switch(it) |
| 1906 | { | ||
| 1907 | case -2: | ||
| 1908 | { | ||
| 1909 | ✗ | for(int32_t i=0; i<MAXLEVELS; i++) | |
| 1910 | { | ||
| 1911 | ✗ | if(game->lvlitems[i]&(1 << li_boss_key)) | |
| 1912 | { | ||
| 1913 | ✗ | return true; | |
| 1914 | } | ||
| 1915 | ✗ | } | |
| 1916 | |||
| 1917 | ✗ | return false; | |
| 1918 | } | ||
| 1919 | |||
| 1920 | case -1: | ||
| 1921 | 206277 | return (game->lvlitems[dlevel]&(1 << li_boss_key))?1:0; | |
| 1922 | |||
| 1923 | default: | ||
| 1924 | ✗ | if(it>=0&&it<MAXLEVELS) | |
| 1925 | { | ||
| 1926 | ✗ | return (game->lvlitems[it]&(1 << li_boss_key))?1:0; | |
| 1927 | } | ||
| 1928 | ✗ | break; | |
| 1929 | } | ||
| 1930 | ✗ | return 0; | |
| 1931 | } | ||
| 1932 | |||
| 1933 | default: | ||
| 1934 | ✗ | int32_t itemid = getItemID(itemsbuf, item_type, it); | |
| 1935 | |||
| 1936 | ✗ | if(itemid == -1) | |
| 1937 | ✗ | return false; | |
| 1938 | |||
| 1939 | ✗ | return game->get_item(itemid); | |
| 1940 | } | ||
| 1941 | 45770965 | } | |
| 1942 | |||
| 1943 | 157325393 | int current_item(int item_type, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 1944 | { | ||
| 1945 |
9/9✓ Branch 0 taken 4628167 times.
✓ Branch 1 taken 120300057 times.
✓ Branch 2 taken 4628167 times.
✓ Branch 3 taken 4628167 times.
✓ Branch 4 taken 4628167 times.
✓ Branch 5 taken 4628167 times.
✓ Branch 6 taken 4628167 times.
✓ Branch 7 taken 4628167 times.
✓ Branch 8 taken 4628167 times.
|
157325393 | switch(item_type) |
| 1946 | { | ||
| 1947 | case itype_clock: | ||
| 1948 | { | ||
| 1949 | 4628167 | int maxid = current_item_id(item_type, checkmagic, jinx_check, check_bunny); | |
| 1950 | |||
| 1951 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4628167 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4628167 | if(maxid != -1 && (itemsbuf[maxid].flags & item_flag1)) //Active clock |
| 1952 | ✗ | return itemsbuf[maxid].level; | |
| 1953 | |||
| 1954 | 4628167 | return has_item(itype_clock,1) ? 1 : 0; | |
| 1955 | } | ||
| 1956 | |||
| 1957 | case itype_key: | ||
| 1958 | 4628167 | return game->get_keys(); | |
| 1959 | |||
| 1960 | case itype_lkey: | ||
| 1961 | 4628167 | return game->lvlkeys[get_dlevel()]; | |
| 1962 | |||
| 1963 | case itype_magiccontainer: | ||
| 1964 | 4628167 | return game->get_maxmagic()/game->get_mp_per_block(); | |
| 1965 | |||
| 1966 | case itype_triforcepiece: | ||
| 1967 | { | ||
| 1968 | 4628167 | int count=0; | |
| 1969 | |||
| 1970 |
2/2✓ Branch 0 taken 2369621504 times.
✓ Branch 1 taken 4628167 times.
|
2374249671 | for(int i=0; i<MAXLEVELS; i++) |
| 1971 | { | ||
| 1972 | 2369621504 | count+=(game->lvlitems[i]&(1 << li_mcguffin))?1:0; | |
| 1973 | 2369621504 | } | |
| 1974 | |||
| 1975 | 4628167 | return count; | |
| 1976 | } | ||
| 1977 | |||
| 1978 | case itype_map: | ||
| 1979 | { | ||
| 1980 | 4628167 | int count=0; | |
| 1981 | |||
| 1982 |
2/2✓ Branch 0 taken 2369621504 times.
✓ Branch 1 taken 4628167 times.
|
2374249671 | for(int i=0; i<MAXLEVELS; i++) |
| 1983 | { | ||
| 1984 | 2369621504 | count+=(game->lvlitems[i]&(1 << li_map))?1:0; | |
| 1985 | 2369621504 | } | |
| 1986 | |||
| 1987 | 4628167 | return count; | |
| 1988 | } | ||
| 1989 | |||
| 1990 | case itype_compass: | ||
| 1991 | { | ||
| 1992 | 4628167 | int count=0; | |
| 1993 | |||
| 1994 |
2/2✓ Branch 0 taken 2369621504 times.
✓ Branch 1 taken 4628167 times.
|
2374249671 | for(int i=0; i<MAXLEVELS; i++) |
| 1995 | { | ||
| 1996 | 2369621504 | count+=(game->lvlitems[i]&(1 << li_compass))?1:0; | |
| 1997 | 2369621504 | } | |
| 1998 | |||
| 1999 | 4628167 | return count; | |
| 2000 | } | ||
| 2001 | |||
| 2002 | case itype_bosskey: | ||
| 2003 | { | ||
| 2004 | 4628167 | int count=0; | |
| 2005 | |||
| 2006 |
2/2✓ Branch 0 taken 2369621504 times.
✓ Branch 1 taken 4628167 times.
|
2374249671 | for(int i=0; i<MAXLEVELS; i++) |
| 2007 | { | ||
| 2008 | 2369621504 | count+=(game->lvlitems[i]&(1 << li_boss_key))?1:0; | |
| 2009 | 2369621504 | } | |
| 2010 | |||
| 2011 | 4628167 | return count; | |
| 2012 | } | ||
| 2013 | |||
| 2014 | default: | ||
| 2015 | 120300057 | int maxid = current_item_id(item_type, checkmagic, jinx_check, check_bunny); | |
| 2016 | |||
| 2017 |
2/2✓ Branch 0 taken 85925739 times.
✓ Branch 1 taken 34374318 times.
|
120300057 | if(maxid == -1) |
| 2018 | 85925739 | return 0; | |
| 2019 | |||
| 2020 | 34374318 | return itemsbuf[maxid].level; | |
| 2021 | } | ||
| 2022 | 157325393 | } | |
| 2023 | |||
| 2024 | 427 | std::map<int32_t, int32_t> itemcache; | |
| 2025 | 427 | std::map<int32_t, int32_t> itemcache_cost; | |
| 2026 | |||
| 2027 | ✗ | void removeFromItemCache(int32_t itemclass) | |
| 2028 | { | ||
| 2029 | ✗ | itemcache.erase(itemclass); | |
| 2030 | ✗ | itemcache_cost.erase(itemclass); | |
| 2031 | ✗ | cache_tile_mod_clear(); | |
| 2032 | ✗ | } | |
| 2033 | |||
| 2034 | 13273719 | void flushItemCache(bool justcost) | |
| 2035 | { | ||
| 2036 | 13273719 | itemcache_cost.clear(); | |
| 2037 |
2/2✓ Branch 0 taken 13196376 times.
✓ Branch 1 taken 77343 times.
|
13273719 | if(!justcost) |
| 2038 | 77343 | itemcache.clear(); | |
| 2039 |
2/2✓ Branch 0 taken 6357348 times.
✓ Branch 1 taken 6839028 times.
|
13196376 | else if(replay_version_check(0,19)) |
| 2040 | 6357348 | return; | |
| 2041 | |||
| 2042 | 6916371 | cache_tile_mod_clear(); | |
| 2043 | |||
| 2044 | //also fix the active subscreen if items were deleted -DD | ||
| 2045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6916371 times.
|
6916371 | if(game != NULL) |
| 2046 | { | ||
| 2047 | 6916371 | verifyBothWeapons(); | |
| 2048 | 6916371 | refresh_subscr_items(); | |
| 2049 | 6916371 | } | |
| 2050 | 13273719 | } | |
| 2051 | |||
| 2052 | // This is used often, so it should be as direct as possible. | ||
| 2053 | 3187207851 | int _c_item_id_internal(int itemtype, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 2054 | { | ||
| 2055 | 3187207851 | bool use_cost_cache = replay_version_check(19); | |
| 2056 |
2/2✓ Branch 0 taken 3043443035 times.
✓ Branch 1 taken 143764816 times.
|
3187207851 | if(jinx_check) |
| 2057 | { | ||
| 2058 | //special case for shields... | ||
| 2059 |
3/4✓ Branch 0 taken 56409667 times.
✓ Branch 1 taken 87355149 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 56409667 times.
|
143764816 | if (itemtype == itype_shield && !HeroShieldClk()) |
| 2060 | 56409667 | jinx_check = false; | |
| 2061 |
4/4✓ Branch 0 taken 54225269 times.
✓ Branch 1 taken 33129880 times.
✓ Branch 2 taken 10934448 times.
✓ Branch 3 taken 43290821 times.
|
87355149 | else if(!(HeroSwordClk() || HeroItemClk())) |
| 2062 | 43290821 | jinx_check = false; //not jinxed | |
| 2063 | 143764816 | } | |
| 2064 |
4/4✓ Branch 0 taken 121490 times.
✓ Branch 1 taken 3187086361 times.
✓ Branch 2 taken 1853 times.
✓ Branch 3 taken 119637 times.
|
3187207851 | if(!Hero.BunnyClock() || itemtype == itype_pearl) // bunny_check does not apply |
| 2065 | 3187088214 | check_bunny = false; | |
| 2066 |
2/2✓ Branch 0 taken 3127300183 times.
✓ Branch 1 taken 59907668 times.
|
3187207851 | if(itemtype == itype_ring) checkmagic = true; |
| 2067 |
4/4✓ Branch 0 taken 3143143523 times.
✓ Branch 1 taken 44064328 times.
✓ Branch 2 taken 310572548 times.
✓ Branch 3 taken 25152461 times.
|
3522932860 | if (!jinx_check && !check_bunny |
| 2068 |
4/4✓ Branch 0 taken 3143051494 times.
✓ Branch 1 taken 92029 times.
✓ Branch 2 taken 335725009 times.
✓ Branch 3 taken 2807326485 times.
|
3143143523 | && (use_cost_cache || itemtype != itype_ring)) |
| 2069 | { | ||
| 2070 |
4/4✓ Branch 0 taken 613715718 times.
✓ Branch 1 taken 2504183315 times.
✓ Branch 2 taken 260092074 times.
✓ Branch 3 taken 353623644 times.
|
3117899033 | auto& cache = checkmagic && use_cost_cache ? itemcache_cost : itemcache; |
| 2071 | 3117899033 | auto res = cache.find(itemtype); | |
| 2072 | |||
| 2073 |
2/2✓ Branch 0 taken 2960822882 times.
✓ Branch 1 taken 157076151 times.
|
3117899033 | if(res != cache.end()) |
| 2074 | 2960822882 | return res->second; | |
| 2075 | 157076151 | } | |
| 2076 | |||
| 2077 | 226384969 | int result = -1; | |
| 2078 | 226384969 | int highestlevel = -1; | |
| 2079 | |||
| 2080 |
2/2✓ Branch 0 taken 57954552064 times.
✓ Branch 1 taken 226384969 times.
|
58180937033 | for(int i=0; i<MAXITEMS; i++) |
| 2081 | { | ||
| 2082 |
6/6✓ Branch 0 taken 6338020401 times.
✓ Branch 1 taken 51616531663 times.
✓ Branch 2 taken 97938805 times.
✓ Branch 3 taken 6240081596 times.
✓ Branch 4 taken 82048 times.
✓ Branch 5 taken 97856757 times.
|
57954552064 | if(game->get_item(i) && itemsbuf[i].type==itemtype && !item_disabled(i)) |
| 2083 | { | ||
| 2084 |
4/4✓ Branch 0 taken 93097357 times.
✓ Branch 1 taken 4759400 times.
✓ Branch 2 taken 2473305 times.
✓ Branch 3 taken 90624052 times.
|
97856757 | if(checkmagic && itemtype != itype_magicring) |
| 2085 |
2/2✓ Branch 0 taken 90620209 times.
✓ Branch 1 taken 3843 times.
|
90624052 | if(!checkmagiccost(i)) |
| 2086 | 3843 | continue; | |
| 2087 |
6/6✓ Branch 0 taken 90363691 times.
✓ Branch 1 taken 7489223 times.
✓ Branch 2 taken 1259466 times.
✓ Branch 3 taken 6229757 times.
✓ Branch 4 taken 4066789 times.
✓ Branch 5 taken 3422434 times.
|
97852914 | if(jinx_check && (usesSwordJinx(i) ? HeroSwordClk() : HeroItemClk())) |
| 2088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3422434 times.
|
3422434 | if(!(itemsbuf[i].flags & item_jinx_immune)) |
| 2089 | 3422434 | continue; | |
| 2090 |
3/4✓ Branch 0 taken 96967 times.
✓ Branch 1 taken 94333513 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96967 times.
|
94430480 | if(check_bunny && !checkbunny(i)) |
| 2091 | 96967 | continue; | |
| 2092 | |||
| 2093 |
2/2✓ Branch 0 taken 8703571 times.
✓ Branch 1 taken 85629942 times.
|
94333513 | if(itemsbuf[i].level >= highestlevel) |
| 2094 | { | ||
| 2095 | 85629942 | highestlevel = itemsbuf[i].level; | |
| 2096 | 85629942 | result=i; | |
| 2097 | 85629942 | } | |
| 2098 | 94333513 | } | |
| 2099 | 57951028820 | } | |
| 2100 | |||
| 2101 |
4/4✓ Branch 0 taken 182320641 times.
✓ Branch 1 taken 44064328 times.
✓ Branch 2 taken 92029 times.
✓ Branch 3 taken 182228612 times.
|
226384969 | if(!(jinx_check || check_bunny)) //Can't cache jinx_check/check_bunny |
| 2102 | { | ||
| 2103 |
2/2✓ Branch 0 taken 140460625 times.
✓ Branch 1 taken 41767987 times.
|
182228612 | if (use_cost_cache) |
| 2104 | { | ||
| 2105 |
2/2✓ Branch 0 taken 122963870 times.
✓ Branch 1 taken 17496755 times.
|
140460625 | if (!checkmagic) |
| 2106 | 17496755 | itemcache[itemtype] = result; | |
| 2107 |
6/6✓ Branch 0 taken 17496755 times.
✓ Branch 1 taken 122963870 times.
✓ Branch 2 taken 738580 times.
✓ Branch 3 taken 16758175 times.
✓ Branch 4 taken 723432 times.
✓ Branch 5 taken 15148 times.
|
140460625 | if (checkmagic || result < 0 || checkmagiccost(result)) |
| 2108 | 140445477 | itemcache_cost[itemtype] = result; | |
| 2109 | 140460625 | } | |
| 2110 | else | ||
| 2111 | { | ||
| 2112 | 41767987 | itemcache[itemtype] = result; | |
| 2113 | } | ||
| 2114 | 182228612 | } | |
| 2115 | 226384969 | return result; | |
| 2116 | 3187207851 | } | |
| 2117 | |||
| 2118 | // 'jinx_check' indicates that the highest level item *immune to jinxes* should be returned. | ||
| 2119 | 3160471334 | int current_item_id(int itype, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 2120 | { | ||
| 2121 |
3/4✓ Branch 0 taken 3143648051 times.
✓ Branch 1 taken 16823283 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3143648051 times.
|
3160471334 | if(itype < 0 || itype >= itype_max) return -1; |
| 2122 |
1/2✓ Branch 0 taken 3143648051 times.
✗ Branch 1 not taken.
|
3143648051 | if(game->OverrideItems[itype] > -2) |
| 2123 | { | ||
| 2124 | ✗ | auto ovid = game->OverrideItems[itype]; | |
| 2125 | ✗ | if(ovid < 0 || ovid >= MAXITEMS) | |
| 2126 | ✗ | return -1; | |
| 2127 | ✗ | if(itemsbuf[ovid].type == itype) | |
| 2128 | { | ||
| 2129 | ✗ | if(itype == itype_magicring) | |
| 2130 | ✗ | checkmagic = false; | |
| 2131 | ✗ | else if(itype == itype_ring) | |
| 2132 | ✗ | checkmagic = true; | |
| 2133 | |||
| 2134 | ✗ | if(checkmagic && !checkmagiccost(ovid)) | |
| 2135 | ✗ | return -1; | |
| 2136 | |||
| 2137 | ✗ | if (jinx_check && !checkitem_jinx(ovid)) | |
| 2138 | { | ||
| 2139 | ✗ | return -1; | |
| 2140 | } | ||
| 2141 | ✗ | return ovid; | |
| 2142 | } | ||
| 2143 | ✗ | } | |
| 2144 | 3143648051 | auto ret = _c_item_id_internal(itype,checkmagic,jinx_check,check_bunny); | |
| 2145 |
2/2✓ Branch 0 taken 100205016 times.
✓ Branch 1 taken 3043443035 times.
|
3143648051 | if(!jinx_check) //If not already a jinx-immune-only check... |
| 2146 | { | ||
| 2147 | //And the player IS jinxed... | ||
| 2148 |
2/2✓ Branch 0 taken 2999883235 times.
✓ Branch 1 taken 43559800 times.
|
3043443035 | if(HeroIsJinxed()) |
| 2149 | { | ||
| 2150 | //Then do a jinx-immune-only check here | ||
| 2151 | 43559800 | auto ret2 = _c_item_id_internal(itype,checkmagic,true,check_bunny); | |
| 2152 | //And *IF IT FINDS A VALID ITEM*, return that one instead! -Em | ||
| 2153 | //Should NOT need a compat rule, as this should always return -1 in old quests. | ||
| 2154 |
2/2✓ Branch 0 taken 3185572 times.
✓ Branch 1 taken 40374228 times.
|
43559800 | if(ret2 > -1) return ret2; |
| 2155 | 40374228 | } | |
| 2156 | 3040257463 | } | |
| 2157 | 3140462479 | return ret; | |
| 2158 | 3160471334 | } | |
| 2159 | |||
| 2160 | 70700359 | int current_item_power(int itemtype, bool checkmagic, bool jinx_check, bool check_bunny) | |
| 2161 | { | ||
| 2162 | 70700359 | int result = current_item_id(itemtype, checkmagic, jinx_check, check_bunny); | |
| 2163 |
2/2✓ Branch 0 taken 37336744 times.
✓ Branch 1 taken 33363615 times.
|
70700359 | return (result<0) ? 0 : itemsbuf[result].power; |
| 2164 | } | ||
| 2165 | |||
| 2166 | 30 | int32_t heart_container_id() | |
| 2167 | { | ||
| 2168 |
1/2✓ Branch 0 taken 870 times.
✗ Branch 1 not taken.
|
870 | for(int32_t i=0; i<MAXITEMS; i++) |
| 2169 | { | ||
| 2170 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 840 times.
|
870 | if(itemsbuf[i].type == itype_heartcontainer) |
| 2171 | { | ||
| 2172 | 30 | return i; | |
| 2173 | } | ||
| 2174 | 840 | } | |
| 2175 | ✗ | return -1; | |
| 2176 | 30 | } | |
| 2177 | |||
| 2178 | struct tilemod_cache_state_t | ||
| 2179 | { | ||
| 2180 |
6/6✓ Branch 0 taken 4627811 times.
✓ Branch 1 taken 8991962 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 8991960 times.
✓ Branch 4 taken 354 times.
✓ Branch 5 taken 8991606 times.
|
22611735 | bool operator==(const tilemod_cache_state_t&) const = default; |
| 2181 | |||
| 2182 | bool valid; | ||
| 2183 | bool bunny_clock; | ||
| 2184 | bool superman; | ||
| 2185 | int shield; | ||
| 2186 | }; | ||
| 2187 | tilemod_cache_state_t tilemod_cache_state; | ||
| 2188 | int32_t tilemod_cache_value; | ||
| 2189 | |||
| 2190 | 6917968 | void cache_tile_mod_clear() | |
| 2191 | { | ||
| 2192 | 6917968 | tilemod_cache_state = {false}; | |
| 2193 | 6917968 | } | |
| 2194 | |||
| 2195 | 13619773 | int32_t item_tile_mod() | |
| 2196 | { | ||
| 2197 | 54479092 | tilemod_cache_state_t state = { | |
| 2198 | .valid = true, | ||
| 2199 | 13619773 | .bunny_clock = Hero.BunnyClock() != 0, | |
| 2200 | 13619773 | .superman = Hero.superman, | |
| 2201 | 13619773 | .shield = Hero.active_shield_id, | |
| 2202 | }; | ||
| 2203 |
2/2✓ Branch 0 taken 8991606 times.
✓ Branch 1 taken 4628167 times.
|
13619773 | if (tilemod_cache_state == state) |
| 2204 | 8991606 | return tilemod_cache_value; | |
| 2205 | |||
| 2206 | 4628167 | int32_t tile=0; | |
| 2207 | 4628167 | bool check_bombcost = !get_qr(qr_BROKEN_BOMB_AMMO_COSTS); | |
| 2208 |
4/4✓ Branch 0 taken 4008000 times.
✓ Branch 1 taken 620167 times.
✓ Branch 2 taken 3079194 times.
✓ Branch 3 taken 928806 times.
|
4628167 | if(check_bombcost || game->get_bombs()) |
| 2209 | { | ||
| 2210 | 3699361 | int32_t itemid = current_item_id(itype_bomb,check_bombcost); | |
| 2211 |
3/4✓ Branch 0 taken 3639680 times.
✓ Branch 1 taken 59681 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3639680 times.
|
3699361 | if(itemid > -1 && checkbunny(itemid)) |
| 2212 | 3639680 | tile+=itemsbuf[itemid].ltm; | |
| 2213 | 3699361 | } | |
| 2214 | |||
| 2215 |
4/4✓ Branch 0 taken 4008000 times.
✓ Branch 1 taken 620167 times.
✓ Branch 2 taken 965298 times.
✓ Branch 3 taken 3042702 times.
|
4628167 | if(check_bombcost || game->get_sbombs()) |
| 2216 | { | ||
| 2217 | 1585465 | int32_t itemid = current_item_id(itype_sbomb,check_bombcost); | |
| 2218 |
3/4✓ Branch 0 taken 976704 times.
✓ Branch 1 taken 608761 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 976704 times.
|
1585465 | if(itemid > -1 && checkbunny(itemid)) |
| 2219 | 976704 | tile+=itemsbuf[itemid].ltm; | |
| 2220 | 1585465 | } | |
| 2221 | |||
| 2222 |
2/2✓ Branch 0 taken 4615318 times.
✓ Branch 1 taken 12849 times.
|
4628167 | if(current_item(itype_clock)) |
| 2223 | { | ||
| 2224 | 12849 | int32_t itemid = | |
| 2225 |
2/2✓ Branch 0 taken 12704 times.
✓ Branch 1 taken 145 times.
|
12849 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2226 | ? iClock | ||
| 2227 | 145 | : getHighestLevelEvenUnowned(itemsbuf, itype_clock); | |
| 2228 |
2/4✓ Branch 0 taken 12849 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12849 times.
|
12849 | if(itemid > -1 && checkbunny(itemid)) |
| 2229 | 12849 | tile+=itemsbuf[itemid].ltm; | |
| 2230 | 12849 | } | |
| 2231 | |||
| 2232 |
2/2✓ Branch 0 taken 3982525 times.
✓ Branch 1 taken 645642 times.
|
4628167 | if(current_item(itype_key)) |
| 2233 | { | ||
| 2234 | 645642 | int32_t itemid = | |
| 2235 |
2/2✓ Branch 0 taken 608640 times.
✓ Branch 1 taken 37002 times.
|
645642 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2236 | ? iKey | ||
| 2237 | 37002 | : getHighestLevelEvenUnowned(itemsbuf, itype_key); | |
| 2238 |
2/4✓ Branch 0 taken 645642 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 645642 times.
|
645642 | if(itemid > -1 && checkbunny(itemid)) |
| 2239 | 645642 | tile+=itemsbuf[itemid].ltm; | |
| 2240 | 645642 | } | |
| 2241 | |||
| 2242 |
2/2✓ Branch 0 taken 4070630 times.
✓ Branch 1 taken 557537 times.
|
4628167 | if(current_item(itype_lkey)) |
| 2243 | { | ||
| 2244 | 557537 | int32_t itemid = | |
| 2245 |
2/2✓ Branch 0 taken 414169 times.
✓ Branch 1 taken 143368 times.
|
557537 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2246 | ? iLevelKey | ||
| 2247 | 143368 | : getHighestLevelEvenUnowned(itemsbuf, itype_lkey); | |
| 2248 |
2/4✓ Branch 0 taken 557537 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 557537 times.
|
557537 | if(itemid > -1 && checkbunny(itemid)) |
| 2249 | 557537 | tile+=itemsbuf[itemid].ltm; | |
| 2250 | 557537 | } | |
| 2251 | |||
| 2252 |
2/2✓ Branch 0 taken 1586486 times.
✓ Branch 1 taken 3041681 times.
|
4628167 | if(current_item(itype_map)) |
| 2253 | { | ||
| 2254 | 3041681 | int32_t itemid = | |
| 2255 |
2/2✓ Branch 0 taken 2823834 times.
✓ Branch 1 taken 217847 times.
|
3041681 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2256 | ? iMap | ||
| 2257 | 217847 | : getHighestLevelEvenUnowned(itemsbuf, itype_map); | |
| 2258 |
2/4✓ Branch 0 taken 3041681 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3041681 times.
|
3041681 | if(itemid > -1 && checkbunny(itemid)) |
| 2259 | 3041681 | tile+=itemsbuf[itemid].ltm; | |
| 2260 | 3041681 | } | |
| 2261 | |||
| 2262 |
2/2✓ Branch 0 taken 2121202 times.
✓ Branch 1 taken 2506965 times.
|
4628167 | if(current_item(itype_compass)) |
| 2263 | { | ||
| 2264 | 2506965 | int32_t itemid = | |
| 2265 |
2/2✓ Branch 0 taken 2295941 times.
✓ Branch 1 taken 211024 times.
|
2506965 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2266 | ? iCompass | ||
| 2267 | 211024 | : getHighestLevelEvenUnowned(itemsbuf, itype_compass); | |
| 2268 |
2/4✓ Branch 0 taken 2506965 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2506965 times.
|
2506965 | if(itemid > -1 && checkbunny(itemid)) |
| 2269 | 2506965 | tile+=itemsbuf[itemid].ltm; | |
| 2270 | 2506965 | } | |
| 2271 | |||
| 2272 |
2/2✓ Branch 0 taken 1346799 times.
✓ Branch 1 taken 3281368 times.
|
4628167 | if(current_item(itype_bosskey)) |
| 2273 | { | ||
| 2274 | 3281368 | int32_t itemid = | |
| 2275 |
2/2✓ Branch 0 taken 2993139 times.
✓ Branch 1 taken 288229 times.
|
3281368 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2276 | ? iBossKey | ||
| 2277 | 288229 | : getHighestLevelEvenUnowned(itemsbuf, itype_bosskey); | |
| 2278 |
2/4✓ Branch 0 taken 3281368 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3281368 times.
|
3281368 | if(itemid > -1 && checkbunny(itemid)) |
| 2279 | 3281368 | tile+=itemsbuf[itemid].ltm; | |
| 2280 | 3281368 | } | |
| 2281 | |||
| 2282 |
2/2✓ Branch 0 taken 48322 times.
✓ Branch 1 taken 4579845 times.
|
4628167 | if(current_item(itype_magiccontainer)) |
| 2283 | { | ||
| 2284 | 4579845 | int32_t itemid = | |
| 2285 |
2/2✓ Branch 0 taken 3904336 times.
✓ Branch 1 taken 675509 times.
|
4579845 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2286 | ? iMagicC | ||
| 2287 | 675509 | : getHighestLevelEvenUnowned(itemsbuf, itype_magiccontainer); | |
| 2288 |
3/4✓ Branch 0 taken 4579845 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 4579828 times.
|
4579845 | if(itemid > -1 && checkbunny(itemid)) |
| 2289 | 4579828 | tile+=itemsbuf[itemid].ltm; | |
| 2290 | 4579845 | } | |
| 2291 | |||
| 2292 |
2/2✓ Branch 0 taken 1328809 times.
✓ Branch 1 taken 3299358 times.
|
4628167 | if(current_item(itype_triforcepiece)) |
| 2293 | { | ||
| 2294 | 3299358 | int32_t itemid = | |
| 2295 |
2/2✓ Branch 0 taken 3069478 times.
✓ Branch 1 taken 229880 times.
|
3299358 | get_qr(qr_HARDCODED_LITEM_LTMS) |
| 2296 | ? iTriforce | ||
| 2297 | 229880 | : getHighestLevelEvenUnowned(itemsbuf, itype_triforcepiece); | |
| 2298 |
2/4✓ Branch 0 taken 3299358 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3299358 times.
|
3299358 | if(itemid > -1 && checkbunny(itemid)) |
| 2299 | 3299358 | tile+=itemsbuf[itemid].ltm; | |
| 2300 | 3299358 | } | |
| 2301 | |||
| 2302 |
2/2✓ Branch 0 taken 2369621504 times.
✓ Branch 1 taken 4628167 times.
|
2374249671 | for(int32_t i=0; i<itype_max; i++) |
| 2303 | { | ||
| 2304 |
2/2✓ Branch 0 taken 2023628800 times.
✓ Branch 1 taken 345992704 times.
|
2369621504 | if(!get_qr(qr_HARDCODED_LITEM_LTMS)) |
| 2305 | { | ||
| 2306 |
2/2✓ Branch 0 taken 6757670 times.
✓ Branch 1 taken 339235034 times.
|
345992704 | switch(i) |
| 2307 | { | ||
| 2308 | case itype_bomb: | ||
| 2309 | case itype_sbomb: | ||
| 2310 | case itype_clock: | ||
| 2311 | case itype_key: | ||
| 2312 | case itype_lkey: | ||
| 2313 | case itype_map: | ||
| 2314 | case itype_compass: | ||
| 2315 | case itype_bosskey: | ||
| 2316 | case itype_magiccontainer: | ||
| 2317 | case itype_triforcepiece: | ||
| 2318 | 6757670 | continue; //already handled | |
| 2319 | } | ||
| 2320 | 339235034 | } | |
| 2321 | 2362863834 | int32_t itemid = current_item_id(i,false); | |
| 2322 |
2/2✓ Branch 0 taken 2358235667 times.
✓ Branch 1 taken 4628167 times.
|
2362863834 | if(i == itype_shield) |
| 2323 | 4628167 | itemid = getCurrentShield(false); | |
| 2324 | |||
| 2325 |
4/4✓ Branch 0 taken 119496253 times.
✓ Branch 1 taken 2243367581 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 119496252 times.
|
2362863834 | if(itemid < 0 || !checkbunny(itemid)) |
| 2326 | 2243367582 | continue; | |
| 2327 | |||
| 2328 | 119496252 | itemdata const& itm = itemsbuf[itemid]; | |
| 2329 | |||
| 2330 |
2/2✓ Branch 0 taken 115589232 times.
✓ Branch 1 taken 3907020 times.
|
119496252 | switch(itm.type) |
| 2331 | { | ||
| 2332 | case itype_shield: | ||
| 2333 |
1/2✓ Branch 0 taken 3907020 times.
✗ Branch 1 not taken.
|
3907020 | if(itm.flags & item_flag9) //active shield |
| 2334 | { | ||
| 2335 | ✗ | if(!usingActiveShield(itemid)) | |
| 2336 | { | ||
| 2337 | ✗ | tile+=itm.misc6; //'Inactive PTM' | |
| 2338 | ✗ | continue; | |
| 2339 | } | ||
| 2340 | ✗ | } | |
| 2341 | 3907020 | break; | |
| 2342 | } | ||
| 2343 | |||
| 2344 | 119496252 | tile+=itm.ltm; | |
| 2345 | 119496252 | } | |
| 2346 | |||
| 2347 | 4628167 | tilemod_cache_value = tile; | |
| 2348 | 4628167 | tilemod_cache_state = state; | |
| 2349 | 4628167 | return tile; | |
| 2350 | 13619773 | } | |
| 2351 | |||
| 2352 | 13619773 | int32_t bunny_tile_mod() | |
| 2353 | { | ||
| 2354 |
2/2✓ Branch 0 taken 1870 times.
✓ Branch 1 taken 13617903 times.
|
13619773 | if(Hero.BunnyClock()) |
| 2355 | { | ||
| 2356 | 1870 | return game->get_bunny_ltm(); | |
| 2357 | } | ||
| 2358 | 13617903 | return 0; | |
| 2359 | 13619773 | } | |
| 2360 | |||
| 2361 | // Hints are drawn on a separate layer to combo reveals. | ||
| 2362 | // TODO: move out of zc_sys.cpp, weird place for this code. | ||
| 2363 | 20058 | void draw_lens_under(BITMAP *dest, bool layer) | |
| 2364 | { | ||
| 2365 | //Lens flag 1: Replacement for qr_LENSHINTS; if set, lens will show hints. Does nothing if flag 2 is set. | ||
| 2366 | //Lens flag 2: Disable "hints", prevent rendering of Secret Combos | ||
| 2367 | //Lens flag 3: Don't show armos/chest/dive items | ||
| 2368 | //Lens flag 4: Show Raft Paths | ||
| 2369 | //Lens flag 5: Show Invisible Enemies | ||
| 2370 |
4/4✓ Branch 0 taken 19602 times.
✓ Branch 1 taken 456 times.
✓ Branch 2 taken 9801 times.
✓ Branch 3 taken 9801 times.
|
20058 | bool hints = (itemsbuf[Hero.getLastLensID()].flags & item_flag2) ? false : (layer && (itemsbuf[Hero.getLastLensID()].flags & item_flag1)); |
| 2371 | |||
| 2372 | 20058 | int32_t strike_hint_table[11]= | |
| 2373 | { | ||
| 2374 | mfARROW, mfBOMB, mfBRANG, mfWANDMAGIC, | ||
| 2375 | mfSWORD, mfREFMAGIC, mfHOOKSHOT, | ||
| 2376 | mfREFFIREBALL, mfHAMMER, mfSWORDBEAM, mfWAND | ||
| 2377 | }; | ||
| 2378 | |||
| 2379 | { | ||
| 2380 | 20058 | int32_t blink_rate=flash_reduction_enabled()?6:1; | |
| 2381 | 20058 | int32_t tempitem, tempweapon=0; | |
| 2382 | 20058 | strike_hint=strike_hint_table[strike_hint_counter]; | |
| 2383 | |||
| 2384 |
2/2✓ Branch 0 taken 19459 times.
✓ Branch 1 taken 599 times.
|
20058 | if(strike_hint_timer>32) |
| 2385 | { | ||
| 2386 | 599 | strike_hint_timer=0; | |
| 2387 | 599 | strike_hint_counter=((strike_hint_counter+1)%11); | |
| 2388 | 599 | } | |
| 2389 | |||
| 2390 | 20058 | ++strike_hint_timer; | |
| 2391 | |||
| 2392 | 3550266 | for_every_visible_rpos_layer0([&](const rpos_handle_t& rpos_handle) { | |
| 2393 | 3530208 | mapscr* scr = rpos_handle.scr; | |
| 2394 | 7306676 | auto [x, y] = rpos_handle.xy(); | |
| 2395 | 7060416 | y += playing_field_offset; | |
| 2396 | |||
| 2397 | 3530208 | int32_t tempitemx=-16, tempitemy=-16; | |
| 2398 | 3530208 | int32_t tempweaponx=-16, tempweapony=-16; | |
| 2399 | |||
| 2400 |
2/2✓ Branch 0 taken 7060416 times.
✓ Branch 1 taken 3530208 times.
|
10590624 | for(int32_t iter=0; iter<2; ++iter) |
| 2401 | { | ||
| 2402 | 7060416 | int32_t checkflag=0; | |
| 2403 | |||
| 2404 |
2/2✓ Branch 0 taken 3530208 times.
✓ Branch 1 taken 3530208 times.
|
7060416 | if(iter==0) |
| 2405 | { | ||
| 2406 | 3530208 | checkflag = rpos_handle.cflag(); | |
| 2407 | 3530208 | } | |
| 2408 | else | ||
| 2409 | { | ||
| 2410 | 3530208 | checkflag = rpos_handle.sflag(); | |
| 2411 | } | ||
| 2412 | |||
| 2413 |
2/2✓ Branch 0 taken 7059318 times.
✓ Branch 1 taken 1098 times.
|
7060416 | if(checkflag==mfSTRIKE) |
| 2414 | { | ||
| 2415 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 906 times.
|
1098 | if(!hints) |
| 2416 | { | ||
| 2417 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 906 times.
|
906 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sSTRIKE],scr->secretcset[sSTRIKE]); |
| 2418 | 906 | } | |
| 2419 | else | ||
| 2420 | { | ||
| 2421 | 192 | checkflag = strike_hint; | |
| 2422 | } | ||
| 2423 | 1098 | } | |
| 2424 | |||
| 2425 |
21/36✓ Branch 0 taken 6911766 times.
✓ Branch 1 taken 3258 times.
✓ Branch 2 taken 108898 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2602 times.
✓ Branch 5 taken 28750 times.
✓ Branch 6 taken 2418 times.
✓ Branch 7 taken 504 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 814 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 93 times.
✓ Branch 15 taken 96 times.
✓ Branch 16 taken 24 times.
✓ Branch 17 taken 25 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 138 times.
✓ Branch 21 taken 16 times.
✓ Branch 22 taken 16 times.
✓ Branch 23 taken 7 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 16 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 17 times.
✓ Branch 32 taken 35 times.
✓ Branch 33 taken 17 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 906 times.
|
7060416 | switch(checkflag) |
| 2426 | { | ||
| 2427 | case 0: | ||
| 2428 | case mfZELDA: | ||
| 2429 | case mfPUSHED: | ||
| 2430 | case mfENEMY0: | ||
| 2431 | case mfENEMY1: | ||
| 2432 | case mfENEMY2: | ||
| 2433 | case mfENEMY3: | ||
| 2434 | case mfENEMY4: | ||
| 2435 | case mfENEMY5: | ||
| 2436 | case mfENEMY6: | ||
| 2437 | case mfENEMY7: | ||
| 2438 | case mfENEMY8: | ||
| 2439 | case mfENEMY9: | ||
| 2440 | case mfSINGLE: | ||
| 2441 | case mfSINGLE16: | ||
| 2442 | case mfNOENEMY: | ||
| 2443 | case mfTRAP_H: | ||
| 2444 | case mfTRAP_V: | ||
| 2445 | case mfTRAP_4: | ||
| 2446 | case mfTRAP_LR: | ||
| 2447 | case mfTRAP_UD: | ||
| 2448 | case mfNOGROUNDENEMY: | ||
| 2449 | case mfNOBLOCKS: | ||
| 2450 | case mfSCRIPT1: | ||
| 2451 | case mfSCRIPT2: | ||
| 2452 | case mfSCRIPT3: | ||
| 2453 | case mfSCRIPT4: | ||
| 2454 | case mfSCRIPT5: | ||
| 2455 | case mfSCRIPT6: | ||
| 2456 | case mfSCRIPT7: | ||
| 2457 | case mfSCRIPT8: | ||
| 2458 | case mfSCRIPT9: | ||
| 2459 | case mfSCRIPT10: | ||
| 2460 | case mfSCRIPT11: | ||
| 2461 | case mfSCRIPT12: | ||
| 2462 | case mfSCRIPT13: | ||
| 2463 | case mfSCRIPT14: | ||
| 2464 | case mfSCRIPT15: | ||
| 2465 | case mfSCRIPT16: | ||
| 2466 | case mfSCRIPT17: | ||
| 2467 | case mfSCRIPT18: | ||
| 2468 | case mfSCRIPT19: | ||
| 2469 | case mfSCRIPT20: | ||
| 2470 | case mfPITHOLE: | ||
| 2471 | case mfPITFALLFLOOR: | ||
| 2472 | case mfLAVA: | ||
| 2473 | case mfICE: | ||
| 2474 | case mfICEDAMAGE: | ||
| 2475 | case mfDAMAGE1: | ||
| 2476 | case mfDAMAGE2: | ||
| 2477 | case mfDAMAGE4: | ||
| 2478 | case mfDAMAGE8: | ||
| 2479 | case mfDAMAGE16: | ||
| 2480 | case mfDAMAGE32: | ||
| 2481 | case mfFREEZEALL: | ||
| 2482 | case mfFREZEALLANSFFCS: | ||
| 2483 | case mfFREEZEFFCSOLY: | ||
| 2484 | case mfSCRITPTW1TRIG: | ||
| 2485 | case mfSCRITPTW2TRIG: | ||
| 2486 | case mfSCRITPTW3TRIG: | ||
| 2487 | case mfSCRITPTW4TRIG: | ||
| 2488 | case mfSCRITPTW5TRIG: | ||
| 2489 | case mfSCRITPTW6TRIG: | ||
| 2490 | case mfSCRITPTW7TRIG: | ||
| 2491 | case mfSCRITPTW8TRIG: | ||
| 2492 | case mfSCRITPTW9TRIG: | ||
| 2493 | case mfSCRITPTW10TRIG: | ||
| 2494 | case mfTROWEL: | ||
| 2495 | case mfTROWELNEXT: | ||
| 2496 | case mfTROWELSPECIALITEM: | ||
| 2497 | case mfSLASHPOT: | ||
| 2498 | case mfLIFTPOT: | ||
| 2499 | case mfLIFTORSLASH: | ||
| 2500 | case mfLIFTROCK: | ||
| 2501 | case mfLIFTROCKHEAVY: | ||
| 2502 | case mfDROPITEM: | ||
| 2503 | case mfSPECIALITEM: | ||
| 2504 | case mfDROPKEY: | ||
| 2505 | case mfDROPLKEY: | ||
| 2506 | case mfDROPCOMPASS: | ||
| 2507 | case mfDROPMAP: | ||
| 2508 | case mfDROPBOSSKEY: | ||
| 2509 | case mfSPAWNNPC: | ||
| 2510 | case mfSWITCHHOOK: | ||
| 2511 | case mfSIDEVIEWLADDER: | ||
| 2512 | case mfSIDEVIEWPLATFORM: | ||
| 2513 | case mfNOENEMYSPAWN: | ||
| 2514 | case mfENEMYALL: | ||
| 2515 | case mfNOMIRROR: | ||
| 2516 | case mfUNSAFEGROUND: | ||
| 2517 | case mf168: | ||
| 2518 | case mf169: | ||
| 2519 | case mf170: | ||
| 2520 | case mf171: | ||
| 2521 | case mf172: | ||
| 2522 | case mf173: | ||
| 2523 | case mf174: | ||
| 2524 | case mf175: | ||
| 2525 | case mf176: | ||
| 2526 | case mf177: | ||
| 2527 | case mf178: | ||
| 2528 | case mf179: | ||
| 2529 | case mf180: | ||
| 2530 | case mf181: | ||
| 2531 | case mf182: | ||
| 2532 | case mf183: | ||
| 2533 | case mf184: | ||
| 2534 | case mf185: | ||
| 2535 | case mf186: | ||
| 2536 | case mf187: | ||
| 2537 | case mf188: | ||
| 2538 | case mf189: | ||
| 2539 | case mf190: | ||
| 2540 | case mf191: | ||
| 2541 | case mf192: | ||
| 2542 | case mf193: | ||
| 2543 | case mf194: | ||
| 2544 | case mf195: | ||
| 2545 | case mf196: | ||
| 2546 | case mf197: | ||
| 2547 | case mf198: | ||
| 2548 | case mf199: | ||
| 2549 | case mf200: | ||
| 2550 | case mf201: | ||
| 2551 | case mf202: | ||
| 2552 | case mf203: | ||
| 2553 | case mf204: | ||
| 2554 | case mf205: | ||
| 2555 | case mf206: | ||
| 2556 | case mf207: | ||
| 2557 | case mf208: | ||
| 2558 | case mf209: | ||
| 2559 | case mf210: | ||
| 2560 | case mf211: | ||
| 2561 | case mf212: | ||
| 2562 | case mf213: | ||
| 2563 | case mf214: | ||
| 2564 | case mf215: | ||
| 2565 | case mf216: | ||
| 2566 | case mf217: | ||
| 2567 | case mf218: | ||
| 2568 | case mf219: | ||
| 2569 | case mf220: | ||
| 2570 | case mf221: | ||
| 2571 | case mf222: | ||
| 2572 | case mf223: | ||
| 2573 | case mf224: | ||
| 2574 | case mf225: | ||
| 2575 | case mf226: | ||
| 2576 | case mf227: | ||
| 2577 | case mf228: | ||
| 2578 | case mf229: | ||
| 2579 | case mf230: | ||
| 2580 | case mf231: | ||
| 2581 | case mf232: | ||
| 2582 | case mf233: | ||
| 2583 | case mf234: | ||
| 2584 | case mf235: | ||
| 2585 | case mf236: | ||
| 2586 | case mf237: | ||
| 2587 | case mf238: | ||
| 2588 | case mf239: | ||
| 2589 | case mf240: | ||
| 2590 | case mf241: | ||
| 2591 | case mf242: | ||
| 2592 | case mf243: | ||
| 2593 | case mf244: | ||
| 2594 | case mf245: | ||
| 2595 | case mf246: | ||
| 2596 | case mf247: | ||
| 2597 | case mf248: | ||
| 2598 | case mf249: | ||
| 2599 | case mf250: | ||
| 2600 | case mf251: | ||
| 2601 | case mf252: | ||
| 2602 | case mf253: | ||
| 2603 | case mf254: | ||
| 2604 | case mfEXTENDED: | ||
| 2605 | 6911766 | break; | |
| 2606 | |||
| 2607 | case mfPUSHUD: | ||
| 2608 | case mfPUSHLR: | ||
| 2609 | case mfPUSH4: | ||
| 2610 | case mfPUSHU: | ||
| 2611 | case mfPUSHD: | ||
| 2612 | case mfPUSHL: | ||
| 2613 | case mfPUSHR: | ||
| 2614 | case mfPUSHUDNS: | ||
| 2615 | case mfPUSHLRNS: | ||
| 2616 | case mfPUSH4NS: | ||
| 2617 | case mfPUSHUNS: | ||
| 2618 | case mfPUSHDNS: | ||
| 2619 | case mfPUSHLNS: | ||
| 2620 | case mfPUSHRNS: | ||
| 2621 | case mfPUSHUDINS: | ||
| 2622 | case mfPUSHLRINS: | ||
| 2623 | case mfPUSH4INS: | ||
| 2624 | case mfPUSHUINS: | ||
| 2625 | case mfPUSHDINS: | ||
| 2626 | case mfPUSHLINS: | ||
| 2627 | case mfPUSHRINS: | ||
| 2628 |
3/4✓ Branch 0 taken 1939 times.
✓ Branch 1 taken 1319 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1939 times.
|
3258 | if(!hints && ((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&16)) |
| 2629 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 1939 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1939 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1939 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&16)))) |
| 2630 | { | ||
| 2631 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->undercombo,scr->undercset); | |
| 2632 | ✗ | } | |
| 2633 | |||
| 2634 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3258 times.
|
3258 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2635 |
3/6✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 738 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 738 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3258 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2636 | { | ||
| 2637 |
2/2✓ Branch 0 taken 1488 times.
✓ Branch 1 taken 1032 times.
|
2520 | if(hints) |
| 2638 | { | ||
| 2639 |
3/3✓ Branch 0 taken 72 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 897 times.
|
1032 | switch (rpos_handle.ctype()) |
| 2640 | { | ||
| 2641 | case cPUSH_HEAVY: | ||
| 2642 | case cPUSH_HW: | ||
| 2643 | 72 | tempitem=getItemIDPower(itemsbuf,itype_bracelet,1); | |
| 2644 | 144 | tempitemx=x, tempitemy=y; | |
| 2645 | |||
| 2646 |
1/2✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
|
72 | if(tempitem>-1) |
| 2647 | 72 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2648 | |||
| 2649 | 72 | break; | |
| 2650 | |||
| 2651 | case cPUSH_HEAVY2: | ||
| 2652 | case cPUSH_HW2: | ||
| 2653 | 63 | tempitem=getItemIDPower(itemsbuf,itype_bracelet,2); | |
| 2654 | 126 | tempitemx=x, tempitemy=y; | |
| 2655 | |||
| 2656 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(tempitem>-1) |
| 2657 | 63 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2658 | |||
| 2659 | 63 | break; | |
| 2660 | } | ||
| 2661 | 1032 | } | |
| 2662 | 2520 | } | |
| 2663 | |||
| 2664 | 3258 | break; | |
| 2665 | |||
| 2666 | case mfWHISTLE: | ||
| 2667 |
1/2✓ Branch 0 taken 2418 times.
✗ Branch 1 not taken.
|
2418 | if(hints) |
| 2668 | { | ||
| 2669 | ✗ | tempitem=getItemID(itemsbuf,itype_whistle,1); | |
| 2670 | |||
| 2671 | ✗ | if(tempitem<0) break; | |
| 2672 | |||
| 2673 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2674 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2675 | { | ||
| 2676 | ✗ | tempitemx=x; | |
| 2677 | ✗ | tempitemy=y; | |
| 2678 | ✗ | } | |
| 2679 | |||
| 2680 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2681 | ✗ | } | |
| 2682 | |||
| 2683 | 2418 | break; | |
| 2684 | |||
| 2685 | //Why is this here? | ||
| 2686 | case mfFAIRY: | ||
| 2687 | case mfMAGICFAIRY: | ||
| 2688 | case mfALLFAIRY: | ||
| 2689 | ✗ | if(hints) | |
| 2690 | { | ||
| 2691 | ✗ | tempitem=getItemID(itemsbuf, itype_fairy,1);//iFairyMoving; | |
| 2692 | |||
| 2693 | ✗ | if(tempitem < 0) break; | |
| 2694 | |||
| 2695 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2696 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2697 | { | ||
| 2698 | ✗ | tempitemx=x; | |
| 2699 | ✗ | tempitemy=y; | |
| 2700 | ✗ | } | |
| 2701 | |||
| 2702 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2703 | ✗ | } | |
| 2704 | |||
| 2705 | ✗ | break; | |
| 2706 | |||
| 2707 | case mfANYFIRE: | ||
| 2708 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 252 times.
|
504 | if(!hints) |
| 2709 | { | ||
| 2710 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 252 times.
|
252 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sBCANDLE],scr->secretcset[sBCANDLE]); |
| 2711 | 252 | } | |
| 2712 | else | ||
| 2713 | { | ||
| 2714 | 252 | tempitem=getItemID(itemsbuf,itype_candle,1); | |
| 2715 | |||
| 2716 |
1/2✓ Branch 0 taken 252 times.
✗ Branch 1 not taken.
|
252 | if(tempitem<0) break; |
| 2717 | |||
| 2718 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 252 times.
|
252 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2719 |
3/6✓ Branch 0 taken 189 times.
✓ Branch 1 taken 63 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 63 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
252 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2720 | { | ||
| 2721 | 189 | tempitemx=x; | |
| 2722 | 189 | tempitemy=y; | |
| 2723 | 189 | } | |
| 2724 | |||
| 2725 | 252 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2726 | } | ||
| 2727 | |||
| 2728 | 504 | break; | |
| 2729 | |||
| 2730 | case mfSTRONGFIRE: | ||
| 2731 | ✗ | if(!hints) | |
| 2732 | { | ||
| 2733 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sRCANDLE],scr->secretcset[sRCANDLE]); | |
| 2734 | ✗ | } | |
| 2735 | else | ||
| 2736 | { | ||
| 2737 | ✗ | tempitem=getItemID(itemsbuf,itype_candle,2); | |
| 2738 | |||
| 2739 | ✗ | if(tempitem<0) break; | |
| 2740 | |||
| 2741 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2742 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2743 | { | ||
| 2744 | ✗ | tempitemx=x; | |
| 2745 | ✗ | tempitemy=y; | |
| 2746 | ✗ | } | |
| 2747 | |||
| 2748 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2749 | } | ||
| 2750 | |||
| 2751 | ✗ | break; | |
| 2752 | |||
| 2753 | case mfMAGICFIRE: | ||
| 2754 | ✗ | if(!hints) | |
| 2755 | { | ||
| 2756 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sWANDFIRE],scr->secretcset[sWANDFIRE]); | |
| 2757 | ✗ | } | |
| 2758 | else | ||
| 2759 | { | ||
| 2760 | ✗ | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 2761 | |||
| 2762 | ✗ | if(tempitem<0) break; | |
| 2763 | |||
| 2764 | ✗ | tempweapon=wFire; | |
| 2765 | |||
| 2766 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2767 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2768 | { | ||
| 2769 | ✗ | tempitemx=x; | |
| 2770 | ✗ | tempitemy=y; | |
| 2771 | ✗ | } | |
| 2772 | else | ||
| 2773 | { | ||
| 2774 | ✗ | tempweaponx=x; | |
| 2775 | ✗ | tempweapony=y; | |
| 2776 | } | ||
| 2777 | |||
| 2778 | ✗ | putweapon(dest,tempweaponx,tempweapony,tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 2779 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2780 | } | ||
| 2781 | |||
| 2782 | ✗ | break; | |
| 2783 | |||
| 2784 | case mfDIVINEFIRE: | ||
| 2785 | ✗ | if(!hints) | |
| 2786 | { | ||
| 2787 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sDIVINEFIRE],scr->secretcset[sDIVINEFIRE]); | |
| 2788 | ✗ | } | |
| 2789 | else | ||
| 2790 | { | ||
| 2791 | ✗ | tempitem=getItemID(itemsbuf,itype_divinefire,1); | |
| 2792 | |||
| 2793 | ✗ | if(tempitem<0) break; | |
| 2794 | |||
| 2795 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2796 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2797 | { | ||
| 2798 | ✗ | tempitemx=x; | |
| 2799 | ✗ | tempitemy=y; | |
| 2800 | ✗ | } | |
| 2801 | |||
| 2802 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2803 | } | ||
| 2804 | |||
| 2805 | ✗ | break; | |
| 2806 | |||
| 2807 | case mfARROW: | ||
| 2808 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 732 times.
|
814 | if(!hints) |
| 2809 | { | ||
| 2810 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 732 times.
|
732 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sARROW],scr->secretcset[sARROW]); |
| 2811 | 732 | } | |
| 2812 | else | ||
| 2813 | { | ||
| 2814 | 82 | tempitem=getItemID(itemsbuf,itype_arrow,1); | |
| 2815 | |||
| 2816 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(tempitem<0) break; |
| 2817 | |||
| 2818 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2819 |
3/6✓ Branch 0 taken 61 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
82 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2820 | { | ||
| 2821 | 61 | tempitemx=x; | |
| 2822 | 61 | tempitemy=y; | |
| 2823 | 61 | } | |
| 2824 | |||
| 2825 | 82 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2826 | } | ||
| 2827 | |||
| 2828 | 814 | break; | |
| 2829 | |||
| 2830 | case mfSARROW: | ||
| 2831 | ✗ | if(!hints) | |
| 2832 | { | ||
| 2833 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sSARROW],scr->secretcset[sSARROW]); | |
| 2834 | ✗ | } | |
| 2835 | else | ||
| 2836 | { | ||
| 2837 | ✗ | tempitem=getItemID(itemsbuf,itype_arrow,2); | |
| 2838 | |||
| 2839 | ✗ | if(tempitem<0) break; | |
| 2840 | |||
| 2841 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2842 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2843 | { | ||
| 2844 | ✗ | tempitemx=x; | |
| 2845 | ✗ | tempitemy=y; | |
| 2846 | ✗ | } | |
| 2847 | |||
| 2848 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2849 | } | ||
| 2850 | |||
| 2851 | ✗ | break; | |
| 2852 | |||
| 2853 | case mfGARROW: | ||
| 2854 | ✗ | if(!hints) | |
| 2855 | { | ||
| 2856 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sGARROW],scr->secretcset[sGARROW]); | |
| 2857 | ✗ | } | |
| 2858 | else | ||
| 2859 | { | ||
| 2860 | ✗ | tempitem=getItemID(itemsbuf,itype_arrow,3); | |
| 2861 | |||
| 2862 | ✗ | if(tempitem<0) break; | |
| 2863 | |||
| 2864 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2865 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2866 | { | ||
| 2867 | ✗ | tempitemx=x; | |
| 2868 | ✗ | tempitemy=y; | |
| 2869 | ✗ | } | |
| 2870 | |||
| 2871 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2872 | } | ||
| 2873 | |||
| 2874 | ✗ | break; | |
| 2875 | |||
| 2876 | case mfBOMB: | ||
| 2877 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 76 times.
|
93 | if(!hints) |
| 2878 | { | ||
| 2879 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 76 times.
|
76 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sBOMB],scr->secretcset[sBOMB]); |
| 2880 | 76 | } | |
| 2881 | else | ||
| 2882 | { | ||
| 2883 | //tempitem=getItemID(itemsbuf,itype_bomb,1); | ||
| 2884 | 17 | tempweapon = wLitBomb; | |
| 2885 | |||
| 2886 | //if (tempitem<0) break; | ||
| 2887 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2888 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2889 | { | ||
| 2890 | 12 | tempweaponx=x; | |
| 2891 | 12 | tempweapony=y; | |
| 2892 | 12 | } | |
| 2893 | |||
| 2894 | 17 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 2895 | } | ||
| 2896 | |||
| 2897 | 93 | break; | |
| 2898 | |||
| 2899 | case mfSBOMB: | ||
| 2900 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 48 times.
|
96 | if(!hints) |
| 2901 | { | ||
| 2902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sSBOMB],scr->secretcset[sSBOMB]); |
| 2903 | 48 | } | |
| 2904 | else | ||
| 2905 | { | ||
| 2906 | //tempitem=getItemID(itemsbuf,itype_sbomb,1); | ||
| 2907 | //if (tempitem<0) break; | ||
| 2908 | 48 | tempweapon = wLitSBomb; | |
| 2909 | |||
| 2910 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2911 |
3/6✓ Branch 0 taken 36 times.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2912 | { | ||
| 2913 | 36 | tempweaponx=x; | |
| 2914 | 36 | tempweapony=y; | |
| 2915 | 36 | } | |
| 2916 | |||
| 2917 | 48 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 2918 | } | ||
| 2919 | |||
| 2920 | 96 | break; | |
| 2921 | |||
| 2922 | case mfARMOS_SECRET: | ||
| 2923 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 12 times.
|
24 | if(!hints) |
| 2924 | { | ||
| 2925 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 2926 | 36 | putcombo(dest,x,y,scr->secretcombo[sSTAIRS],scr->secretcset[sSTAIRS]); | |
| 2927 | 12 | } | |
| 2928 | 24 | break; | |
| 2929 | |||
| 2930 | case mfBRANG: | ||
| 2931 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 20 times.
|
25 | if(!hints) |
| 2932 | { | ||
| 2933 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 2934 | 60 | putcombo(dest,x,y,scr->secretcombo[sBRANG],scr->secretcset[sBRANG]); | |
| 2935 | 20 | } | |
| 2936 | else | ||
| 2937 | { | ||
| 2938 | 5 | tempitem=getItemID(itemsbuf,itype_brang,1); | |
| 2939 | |||
| 2940 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(tempitem<0) break; |
| 2941 | |||
| 2942 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 2943 |
3/6✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 2944 | { | ||
| 2945 | 4 | tempitemx=x; | |
| 2946 | 4 | tempitemy=y; | |
| 2947 | 4 | } | |
| 2948 | |||
| 2949 | 5 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2950 | } | ||
| 2951 | |||
| 2952 | 25 | break; | |
| 2953 | |||
| 2954 | case mfMBRANG: | ||
| 2955 | ✗ | if(!hints) | |
| 2956 | { | ||
| 2957 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sMBRANG],scr->secretcset[sMBRANG]); | |
| 2958 | ✗ | } | |
| 2959 | else | ||
| 2960 | { | ||
| 2961 | ✗ | tempitem=getItemID(itemsbuf,itype_brang,2); | |
| 2962 | |||
| 2963 | ✗ | if(tempitem<0) break; | |
| 2964 | |||
| 2965 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2966 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2967 | { | ||
| 2968 | ✗ | tempitemx=x; | |
| 2969 | ✗ | tempitemy=y; | |
| 2970 | ✗ | } | |
| 2971 | |||
| 2972 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2973 | } | ||
| 2974 | |||
| 2975 | ✗ | break; | |
| 2976 | |||
| 2977 | case mfFBRANG: | ||
| 2978 | ✗ | if(!hints) | |
| 2979 | { | ||
| 2980 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sFBRANG],scr->secretcset[sFBRANG]); | |
| 2981 | ✗ | } | |
| 2982 | else | ||
| 2983 | { | ||
| 2984 | ✗ | tempitem=getItemID(itemsbuf,itype_brang,3); | |
| 2985 | |||
| 2986 | ✗ | if(tempitem<0) break; | |
| 2987 | |||
| 2988 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 2989 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 2990 | { | ||
| 2991 | ✗ | tempitemx=x; | |
| 2992 | ✗ | tempitemy=y; | |
| 2993 | ✗ | } | |
| 2994 | |||
| 2995 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 2996 | } | ||
| 2997 | |||
| 2998 | ✗ | break; | |
| 2999 | |||
| 3000 | case mfWANDMAGIC: | ||
| 3001 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(!hints) |
| 3002 | { | ||
| 3003 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sWANDMAGIC],scr->secretcset[sWANDMAGIC]); |
| 3004 | 138 | } | |
| 3005 | else | ||
| 3006 | { | ||
| 3007 | ✗ | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 3008 | |||
| 3009 | ✗ | if(tempitem<0) break; | |
| 3010 | |||
| 3011 | ✗ | tempweapon=itemsbuf[tempitem].wpn3; | |
| 3012 | |||
| 3013 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3014 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3015 | { | ||
| 3016 | ✗ | tempitemx=x; | |
| 3017 | ✗ | tempitemy=y; | |
| 3018 | ✗ | } | |
| 3019 | else | ||
| 3020 | { | ||
| 3021 | ✗ | tempweaponx=x; | |
| 3022 | ✗ | tempweapony=y; | |
| 3023 | ✗ | --lens_hint_weapon[wMagic][4]; | |
| 3024 | |||
| 3025 | ✗ | if(lens_hint_weapon[wMagic][4]<-8) | |
| 3026 | { | ||
| 3027 | ✗ | lens_hint_weapon[wMagic][4]=8; | |
| 3028 | ✗ | } | |
| 3029 | } | ||
| 3030 | |||
| 3031 | ✗ | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3032 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3033 | } | ||
| 3034 | |||
| 3035 | 138 | break; | |
| 3036 | |||
| 3037 | case mfREFMAGIC: | ||
| 3038 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3039 | { | ||
| 3040 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sREFMAGIC],scr->secretcset[sREFMAGIC]); | |
| 3041 | ✗ | } | |
| 3042 | else | ||
| 3043 | { | ||
| 3044 | 16 | tempitem=getItemID(itemsbuf,itype_shield,3); | |
| 3045 | |||
| 3046 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3047 | |||
| 3048 | 16 | tempweapon=ewMagic; | |
| 3049 | |||
| 3050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3051 |
3/6✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3052 | { | ||
| 3053 | 13 | tempitemx=x; | |
| 3054 | 13 | tempitemy=y; | |
| 3055 | 13 | } | |
| 3056 | else | ||
| 3057 | { | ||
| 3058 | 3 | tempweaponx=x; | |
| 3059 | 3 | tempweapony=y; | |
| 3060 | |||
| 3061 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | if(lens_hint_weapon[ewMagic][2]==up) |
| 3062 | { | ||
| 3063 | 1 | --lens_hint_weapon[ewMagic][4]; | |
| 3064 | 1 | } | |
| 3065 | else | ||
| 3066 | { | ||
| 3067 | 2 | ++lens_hint_weapon[ewMagic][4]; | |
| 3068 | } | ||
| 3069 | |||
| 3070 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if(lens_hint_weapon[ewMagic][4]>8) |
| 3071 | { | ||
| 3072 | ✗ | lens_hint_weapon[ewMagic][2]=up; | |
| 3073 | ✗ | } | |
| 3074 | |||
| 3075 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if(lens_hint_weapon[ewMagic][4]<=0) |
| 3076 | { | ||
| 3077 | 2 | lens_hint_weapon[ewMagic][2]=down; | |
| 3078 | 2 | } | |
| 3079 | } | ||
| 3080 | |||
| 3081 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3082 | 16 | putweapon(dest,tempweaponx,tempweapony+lens_hint_weapon[tempweapon][4],tempweapon, 0, lens_hint_weapon[ewMagic][2], lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3083 | } | ||
| 3084 | |||
| 3085 | 16 | break; | |
| 3086 | |||
| 3087 | case mfREFFIREBALL: | ||
| 3088 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3089 | { | ||
| 3090 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sREFFIREBALL],scr->secretcset[sREFFIREBALL]); | |
| 3091 | ✗ | } | |
| 3092 | else | ||
| 3093 | { | ||
| 3094 | 16 | tempitem=getItemID(itemsbuf,itype_shield,3); | |
| 3095 | |||
| 3096 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3097 | |||
| 3098 | 16 | tempweapon=ewFireball; | |
| 3099 | |||
| 3100 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3101 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3102 | { | ||
| 3103 | 12 | tempitemx=x; | |
| 3104 | 12 | tempitemy=y; | |
| 3105 | 12 | tempweaponx=x; | |
| 3106 | 12 | tempweapony=y; | |
| 3107 | 12 | ++lens_hint_weapon[ewFireball][3]; | |
| 3108 | |||
| 3109 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 times.
|
12 | if(lens_hint_weapon[ewFireball][3]>8) |
| 3110 | { | ||
| 3111 | 1 | lens_hint_weapon[ewFireball][3]=-8; | |
| 3112 | 1 | lens_hint_weapon[ewFireball][4]=8; | |
| 3113 | 1 | } | |
| 3114 | |||
| 3115 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
|
12 | if(lens_hint_weapon[ewFireball][3]>0) |
| 3116 | { | ||
| 3117 | 8 | ++lens_hint_weapon[ewFireball][4]; | |
| 3118 | 8 | } | |
| 3119 | else | ||
| 3120 | { | ||
| 3121 | 4 | --lens_hint_weapon[ewFireball][4]; | |
| 3122 | } | ||
| 3123 | 12 | } | |
| 3124 | |||
| 3125 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3126 | 16 | putweapon(dest,tempweaponx+lens_hint_weapon[tempweapon][3],tempweapony+lens_hint_weapon[ewFireball][4],tempweapon, 0, up, lens_hint_weapon[tempweapon][0], lens_hint_weapon[tempweapon][1],-1); | |
| 3127 | } | ||
| 3128 | |||
| 3129 | 16 | break; | |
| 3130 | |||
| 3131 | case mfSWORD: | ||
| 3132 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!hints) |
| 3133 | { | ||
| 3134 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sSWORD],scr->secretcset[sSWORD]); | |
| 3135 | ✗ | } | |
| 3136 | else | ||
| 3137 | { | ||
| 3138 | 7 | tempitem=getItemID(itemsbuf,itype_sword,1); | |
| 3139 | |||
| 3140 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(tempitem<0) break; |
| 3141 | |||
| 3142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3143 |
3/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3144 | { | ||
| 3145 | 5 | tempitemx=x; | |
| 3146 | 5 | tempitemy=y; | |
| 3147 | 5 | } | |
| 3148 | |||
| 3149 | 7 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3150 | } | ||
| 3151 | |||
| 3152 | 7 | break; | |
| 3153 | |||
| 3154 | case mfWSWORD: | ||
| 3155 | ✗ | if(!hints) | |
| 3156 | { | ||
| 3157 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sWSWORD],scr->secretcset[sWSWORD]); | |
| 3158 | ✗ | } | |
| 3159 | else | ||
| 3160 | { | ||
| 3161 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,2); | |
| 3162 | |||
| 3163 | ✗ | if(tempitem<0) break; | |
| 3164 | |||
| 3165 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3166 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3167 | { | ||
| 3168 | ✗ | tempitemx=x; | |
| 3169 | ✗ | tempitemy=y; | |
| 3170 | ✗ | } | |
| 3171 | |||
| 3172 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3173 | } | ||
| 3174 | |||
| 3175 | ✗ | break; | |
| 3176 | |||
| 3177 | case mfMSWORD: | ||
| 3178 | ✗ | if(!hints) | |
| 3179 | { | ||
| 3180 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sMSWORD],scr->secretcset[sMSWORD]); | |
| 3181 | ✗ | } | |
| 3182 | else | ||
| 3183 | { | ||
| 3184 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,3); | |
| 3185 | |||
| 3186 | ✗ | if(tempitem<0) break; | |
| 3187 | |||
| 3188 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3189 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3190 | { | ||
| 3191 | ✗ | tempitemx=x; | |
| 3192 | ✗ | tempitemy=y; | |
| 3193 | ✗ | } | |
| 3194 | |||
| 3195 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3196 | } | ||
| 3197 | |||
| 3198 | ✗ | break; | |
| 3199 | |||
| 3200 | case mfXSWORD: | ||
| 3201 | ✗ | if(!hints) | |
| 3202 | { | ||
| 3203 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sXSWORD],scr->secretcset[sXSWORD]); | |
| 3204 | ✗ | } | |
| 3205 | else | ||
| 3206 | { | ||
| 3207 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,4); | |
| 3208 | |||
| 3209 | ✗ | if(tempitem<0) break; | |
| 3210 | |||
| 3211 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3212 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3213 | { | ||
| 3214 | ✗ | tempitemx=x; | |
| 3215 | ✗ | tempitemy=y; | |
| 3216 | ✗ | } | |
| 3217 | |||
| 3218 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3219 | } | ||
| 3220 | |||
| 3221 | ✗ | break; | |
| 3222 | |||
| 3223 | case mfSWORDBEAM: | ||
| 3224 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!hints) |
| 3225 | { | ||
| 3226 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sSWORDBEAM],scr->secretcset[sSWORDBEAM]); | |
| 3227 | ✗ | } | |
| 3228 | else | ||
| 3229 | { | ||
| 3230 | 16 | tempitem=getItemID(itemsbuf,itype_sword,1); | |
| 3231 | |||
| 3232 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(tempitem<0) break; |
| 3233 | |||
| 3234 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3235 |
3/6✓ Branch 0 taken 11 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3236 | { | ||
| 3237 | 11 | tempitemx=x; | |
| 3238 | 11 | tempitemy=y; | |
| 3239 | 11 | } | |
| 3240 | |||
| 3241 | 16 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 1); | |
| 3242 | } | ||
| 3243 | |||
| 3244 | 16 | break; | |
| 3245 | |||
| 3246 | case mfWSWORDBEAM: | ||
| 3247 | ✗ | if(!hints) | |
| 3248 | { | ||
| 3249 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sWSWORDBEAM],scr->secretcset[sWSWORDBEAM]); | |
| 3250 | ✗ | } | |
| 3251 | else | ||
| 3252 | { | ||
| 3253 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,2); | |
| 3254 | |||
| 3255 | ✗ | if(tempitem<0) break; | |
| 3256 | |||
| 3257 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3258 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3259 | { | ||
| 3260 | ✗ | tempitemx=x; | |
| 3261 | ✗ | tempitemy=y; | |
| 3262 | ✗ | } | |
| 3263 | |||
| 3264 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 2); | |
| 3265 | } | ||
| 3266 | |||
| 3267 | ✗ | break; | |
| 3268 | |||
| 3269 | case mfMSWORDBEAM: | ||
| 3270 | ✗ | if(!hints) | |
| 3271 | { | ||
| 3272 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sMSWORDBEAM],scr->secretcset[sMSWORDBEAM]); | |
| 3273 | ✗ | } | |
| 3274 | else | ||
| 3275 | { | ||
| 3276 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,3); | |
| 3277 | |||
| 3278 | ✗ | if(tempitem<0) break; | |
| 3279 | |||
| 3280 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3281 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3282 | { | ||
| 3283 | ✗ | tempitemx=x; | |
| 3284 | ✗ | tempitemy=y; | |
| 3285 | ✗ | } | |
| 3286 | |||
| 3287 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 3); | |
| 3288 | } | ||
| 3289 | |||
| 3290 | ✗ | break; | |
| 3291 | |||
| 3292 | case mfXSWORDBEAM: | ||
| 3293 | ✗ | if(!hints) | |
| 3294 | { | ||
| 3295 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sXSWORDBEAM],scr->secretcset[sXSWORDBEAM]); | |
| 3296 | ✗ | } | |
| 3297 | else | ||
| 3298 | { | ||
| 3299 | ✗ | tempitem=getItemID(itemsbuf,itype_sword,4); | |
| 3300 | |||
| 3301 | ✗ | if(tempitem<0) break; | |
| 3302 | |||
| 3303 | ✗ | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) | |
| 3304 | ✗ | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) | |
| 3305 | { | ||
| 3306 | ✗ | tempitemx=x; | |
| 3307 | ✗ | tempitemy=y; | |
| 3308 | ✗ | } | |
| 3309 | |||
| 3310 | ✗ | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 4); | |
| 3311 | } | ||
| 3312 | |||
| 3313 | ✗ | break; | |
| 3314 | |||
| 3315 | case mfHOOKSHOT: | ||
| 3316 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!hints) |
| 3317 | { | ||
| 3318 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sHOOKSHOT],scr->secretcset[sHOOKSHOT]); | |
| 3319 | ✗ | } | |
| 3320 | else | ||
| 3321 | { | ||
| 3322 | 17 | tempitem=getItemID(itemsbuf,itype_hookshot,1); | |
| 3323 | |||
| 3324 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(tempitem<0) break; |
| 3325 | |||
| 3326 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3327 |
3/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3328 | { | ||
| 3329 | 12 | tempitemx=x; | |
| 3330 | 12 | tempitemy=y; | |
| 3331 | 12 | } | |
| 3332 | |||
| 3333 | 17 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3334 | } | ||
| 3335 | |||
| 3336 | 17 | break; | |
| 3337 | |||
| 3338 | case mfWAND: | ||
| 3339 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(!hints) |
| 3340 | { | ||
| 3341 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sWAND],scr->secretcset[sWAND]); | |
| 3342 | ✗ | } | |
| 3343 | else | ||
| 3344 | { | ||
| 3345 | 35 | tempitem=getItemID(itemsbuf,itype_wand,1); | |
| 3346 | |||
| 3347 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(tempitem<0) break; |
| 3348 | |||
| 3349 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3350 |
3/6✓ Branch 0 taken 28 times.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
35 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3351 | { | ||
| 3352 | 28 | tempitemx=x; | |
| 3353 | 28 | tempitemy=y; | |
| 3354 | 28 | } | |
| 3355 | |||
| 3356 | 35 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3357 | } | ||
| 3358 | |||
| 3359 | 35 | break; | |
| 3360 | |||
| 3361 | case mfHAMMER: | ||
| 3362 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!hints) |
| 3363 | { | ||
| 3364 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2))putcombo(dest,x,y,scr->secretcombo[sHAMMER],scr->secretcset[sHAMMER]); | |
| 3365 | ✗ | } | |
| 3366 | else | ||
| 3367 | { | ||
| 3368 | 17 | tempitem=getItemID(itemsbuf,itype_hammer,1); | |
| 3369 | |||
| 3370 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(tempitem<0) break; |
| 3371 | |||
| 3372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) |
| 3373 |
3/6✓ Branch 0 taken 13 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3374 | { | ||
| 3375 | 13 | tempitemx=x; | |
| 3376 | 13 | tempitemy=y; | |
| 3377 | 13 | } | |
| 3378 | |||
| 3379 | 17 | putitem2(dest,tempitemx,tempitemy,tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3380 | } | ||
| 3381 | |||
| 3382 | 17 | break; | |
| 3383 | |||
| 3384 | case mfARMOS_ITEM: | ||
| 3385 | case mfDIVE_ITEM: | ||
| 3386 | { | ||
| 3387 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2602 times.
|
2602 | int flag = (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM; |
| 3388 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 2602 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2602 times.
|
2602 | if((!getmapflag(scr, flag) || (scr->flags9&fBELOWRETURN)) && !(itemsbuf[Hero.getLastLensID()].flags & item_flag3)) |
| 3389 | { | ||
| 3390 | 7806 | putitem2(dest,x,y,scr->catchall, lens_hint_item[scr->catchall][0], lens_hint_item[scr->catchall][1], 0); | |
| 3391 | 2602 | } | |
| 3392 | 2602 | break; | |
| 3393 | } | ||
| 3394 | |||
| 3395 | case 16: | ||
| 3396 | case 17: | ||
| 3397 | case 18: | ||
| 3398 | case 19: | ||
| 3399 | case 20: | ||
| 3400 | case 21: | ||
| 3401 | case 22: | ||
| 3402 | case 23: | ||
| 3403 | case 24: | ||
| 3404 | case 25: | ||
| 3405 | case 26: | ||
| 3406 | case 27: | ||
| 3407 | case 28: | ||
| 3408 | case 29: | ||
| 3409 | case 30: | ||
| 3410 | case 31: | ||
| 3411 |
2/2✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 107890 times.
|
108898 | if(!hints) |
| 3412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 107890 times.
|
215780 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 3413 | 323670 | putcombo(dest,x,y,scr->secretcombo[checkflag-16+4],scr->secretcset[checkflag-16+4]); | |
| 3414 | |||
| 3415 | 108898 | break; | |
| 3416 | case mfSECRETSNEXT: | ||
| 3417 | ✗ | if(!hints) | |
| 3418 | ✗ | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) | |
| 3419 | ✗ | putcombo(dest,x,y,rpos_handle.data()+1,rpos_handle.cset()); | |
| 3420 | |||
| 3421 | ✗ | break; | |
| 3422 | |||
| 3423 | case mfSTRIKE: | ||
| 3424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 906 times.
|
906 | if(!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 3425 | { | ||
| 3426 | 906 | goto special; | |
| 3427 | } | ||
| 3428 | else | ||
| 3429 | { | ||
| 3430 | ✗ | break; | |
| 3431 | } | ||
| 3432 | |||
| 3433 | 28750 | default: goto special; | |
| 3434 | |||
| 3435 | special: | ||
| 3436 |
8/8✓ Branch 0 taken 14732 times.
✓ Branch 1 taken 14924 times.
✓ Branch 2 taken 528 times.
✓ Branch 3 taken 14204 times.
✓ Branch 4 taken 496 times.
✓ Branch 5 taken 32 times.
✓ Branch 6 taken 6108 times.
✓ Branch 7 taken 8128 times.
|
29656 | if(layer && ((checkflag!=mfRAFT && checkflag!=mfRAFT_BRANCH&& checkflag!=mfRAFT_BOUNCE) ||(itemsbuf[Hero.getLastLensID()].flags & item_flag4))) |
| 3437 | { | ||
| 3438 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 6604 times.
✓ Branch 2 taken 4954 times.
✓ Branch 3 taken 1650 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1650 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6604 | if((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&blink_rate)) || ((get_debug() && zc_getkey(KEY_N)) && (frame&blink_rate))) |
| 3439 | { | ||
| 3440 | 24770 | rectfill(dest,x,y,x+15,y+15,WHITE); | |
| 3441 | 4954 | } | |
| 3442 | 6604 | } | |
| 3443 | |||
| 3444 | 29656 | break; | |
| 3445 | } | ||
| 3446 | 7060416 | } | |
| 3447 | 3530208 | }); | |
| 3448 | |||
| 3449 | 40116 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { | |
| 3450 | 90824 | auto [offx, offy] = translate_screen_coordinates_to_world(scr->screen); | |
| 3451 | |||
| 3452 | 40116 | offx -= viewport.x; | |
| 3453 | 40116 | offy -= viewport.y; | |
| 3454 | 40116 | offy += playing_field_offset; | |
| 3455 | |||
| 3456 |
2/2✓ Branch 0 taken 10029 times.
✓ Branch 1 taken 10029 times.
|
20058 | if (layer) |
| 3457 | { | ||
| 3458 |
2/2✓ Branch 0 taken 9670 times.
✓ Branch 1 taken 359 times.
|
10029 | if (scr->door[0]==dWALK) |
| 3459 | 1795 | rectfill(dest, 120+offx, 16+offy, 135+offx, 31+offy, WHITE); | |
| 3460 | |||
| 3461 |
2/2✓ Branch 0 taken 9606 times.
✓ Branch 1 taken 423 times.
|
10029 | if (scr->door[1]==dWALK) |
| 3462 | 2115 | rectfill(dest, 120+offx, 144+offy, 135+offx, 159+offy, WHITE); | |
| 3463 | |||
| 3464 |
2/2✓ Branch 0 taken 9447 times.
✓ Branch 1 taken 582 times.
|
10029 | if (scr->door[2]==dWALK) |
| 3465 | 2910 | rectfill(dest, 16+offx, 80+offy, 31+offx, 95+offy, WHITE); | |
| 3466 | |||
| 3467 |
2/2✓ Branch 0 taken 9405 times.
✓ Branch 1 taken 624 times.
|
10029 | if (scr->door[3]==dWALK) |
| 3468 | 3120 | rectfill(dest, 224+offx, 80+offy, 239+offx, 95+offy, WHITE); | |
| 3469 | |||
| 3470 |
2/2✓ Branch 0 taken 9986 times.
✓ Branch 1 taken 43 times.
|
10029 | if (scr->door[0]==dBOMB) |
| 3471 | { | ||
| 3472 | 129 | showbombeddoor(scr, dest, 0, offx, offy); | |
| 3473 | 43 | } | |
| 3474 | |||
| 3475 |
2/2✓ Branch 0 taken 9990 times.
✓ Branch 1 taken 39 times.
|
10029 | if (scr->door[1]==dBOMB) |
| 3476 | { | ||
| 3477 | 117 | showbombeddoor(scr, dest, 1, offx, offy); | |
| 3478 | 39 | } | |
| 3479 | |||
| 3480 |
2/2✓ Branch 0 taken 10023 times.
✓ Branch 1 taken 6 times.
|
10029 | if (scr->door[2]==dBOMB) |
| 3481 | { | ||
| 3482 | 18 | showbombeddoor(scr, dest, 2, offx, offy); | |
| 3483 | 6 | } | |
| 3484 | |||
| 3485 |
2/2✓ Branch 0 taken 9992 times.
✓ Branch 1 taken 37 times.
|
10029 | if (scr->door[3]==dBOMB) |
| 3486 | { | ||
| 3487 | 111 | showbombeddoor(scr, dest, 3, offx, offy); | |
| 3488 | 37 | } | |
| 3489 | 10029 | } | |
| 3490 | |||
| 3491 |
3/4✓ Branch 0 taken 18024 times.
✓ Branch 1 taken 2034 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18024 times.
|
20058 | if (scr->stairx || scr->stairy) |
| 3492 | { | ||
| 3493 |
2/2✓ Branch 0 taken 911 times.
✓ Branch 1 taken 1123 times.
|
2034 | if (!hints) |
| 3494 | { | ||
| 3495 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1123 times.
|
1123 | if (!(itemsbuf[Hero.getLastLensID()].flags & item_flag2)) |
| 3496 | 3369 | putcombo(dest,scr->stairx+offx,scr->stairy+offy,scr->secretcombo[sSTAIRS],scr->secretcset[sSTAIRS]); | |
| 3497 | 1123 | } | |
| 3498 | else | ||
| 3499 | { | ||
| 3500 |
2/2✓ Branch 0 taken 863 times.
✓ Branch 1 taken 48 times.
|
911 | if(scr->flags&fWHISTLE) |
| 3501 | { | ||
| 3502 | 48 | tempitem=getItemID(itemsbuf,itype_whistle,1); | |
| 3503 | 48 | int32_t tempitemx=-16+offx; | |
| 3504 | 48 | int32_t tempitemy=-16+offy-playing_field_offset; | |
| 3505 | |||
| 3506 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if ((!(get_debug() && zc_getkey(KEY_N)) && (lensclk&(blink_rate/4))) |
| 3507 |
3/6✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48 | || ((get_debug() && zc_getkey(KEY_N)) && (frame&(blink_rate/4)))) |
| 3508 | { | ||
| 3509 | 48 | tempitemx=scr->stairx+offx; | |
| 3510 | 48 | tempitemy=scr->stairy+offy; | |
| 3511 | 24 | } | |
| 3512 | |||
| 3513 | 48 | putitem2(dest, tempitemx, tempitemy, tempitem, lens_hint_item[tempitem][0], lens_hint_item[tempitem][1], 0); | |
| 3514 | 48 | } | |
| 3515 | } | ||
| 3516 | 2034 | } | |
| 3517 | 20058 | }); | |
| 3518 | } | ||
| 3519 | 20058 | } | |
| 3520 | |||
| 3521 | 9690 | void draw_lens_over(BITMAP *dest) | |
| 3522 | { | ||
| 3523 | 9690 | int w = 288; | |
| 3524 | 9690 | int h = 240; | |
| 3525 | |||
| 3526 |
4/6✓ Branch 0 taken 18 times.
✓ Branch 1 taken 9672 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
|
9690 | static BITMAP *lens_scr = create_bitmap_ex(8,2*w,2*h); |
| 3527 | static int32_t last_width = -1; | ||
| 3528 | 9690 | int32_t width = itemsbuf[current_item_id(itype_lens,true)].misc1; | |
| 3529 | |||
| 3530 | // Only redraw the circle if the size has changed | ||
| 3531 |
2/2✓ Branch 0 taken 9670 times.
✓ Branch 1 taken 20 times.
|
9690 | if (width != last_width) |
| 3532 | { | ||
| 3533 | 20 | clear_to_color(lens_scr, BLACK); | |
| 3534 | 20 | circlefill(lens_scr, w, h, width, 0); | |
| 3535 | 20 | circle(lens_scr, w, h, width+2, 0); | |
| 3536 | 20 | circle(lens_scr, w, h, width+5, 0); | |
| 3537 | 20 | last_width=width; | |
| 3538 | 20 | } | |
| 3539 | |||
| 3540 | 9690 | masked_blit(lens_scr, dest, w-(HeroX()+8)+viewport.x, h-(HeroY()+8)+viewport.y, 0, playing_field_offset, 256, viewport.h); | |
| 3541 | 9690 | do_primitives(dest, SPLAYER_LENS_OVER); | |
| 3542 | 9690 | } | |
| 3543 | |||
| 3544 | 38494248 | static void update_bmp_size(BITMAP** bmp_ptr, int w, int h) | |
| 3545 | { | ||
| 3546 | 38494248 | BITMAP* bmp = *bmp_ptr; | |
| 3547 |
3/4✓ Branch 0 taken 38494248 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38494242 times.
✓ Branch 3 taken 6 times.
|
38494248 | if (bmp->w == w && bmp->h == h) |
| 3548 | 38494242 | return; | |
| 3549 | |||
| 3550 | 6 | int depth = bitmap_color_depth(bmp); | |
| 3551 | 6 | destroy_bitmap(bmp); | |
| 3552 | 6 | *bmp_ptr = create_bitmap_ex(depth, w, h); | |
| 3553 | 38494248 | } | |
| 3554 | |||
| 3555 | 32028 | void draw_wavy(BITMAP *source, BITMAP *target, int32_t amplitude, bool interpol) | |
| 3556 | { | ||
| 3557 |
4/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 32022 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
32028 | static BITMAP *wavebuf = create_bitmap_ex(8,288,240-original_playing_field_offset); |
| 3558 | 32028 | update_bmp_size(&wavebuf, 288, 240 - original_playing_field_offset); | |
| 3559 | |||
| 3560 | 32028 | clear_to_color(wavebuf, BLACK); | |
| 3561 | 32028 | blit(source,wavebuf,0,original_playing_field_offset,16,0,256,framebuf->h-original_playing_field_offset); | |
| 3562 | |||
| 3563 | int32_t ofs; | ||
| 3564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32028 times.
|
32028 | amplitude = zc_min(2048,amplitude); // some arbitrary limit to prevent crashing |
| 3565 |
4/6✓ Branch 0 taken 32028 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32028 times.
✓ Branch 4 taken 606 times.
✓ Branch 5 taken 31422 times.
|
32028 | if(flash_reduction_enabled() && !get_qr(qr_WAVY_NO_EPILEPSY)) amplitude = zc_min(16,amplitude); |
| 3566 | 32028 | int32_t amp2 = viewport.visible_height(show_bottom_8px); | |
| 3567 |
2/4✓ Branch 0 taken 32028 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32028 times.
|
32028 | if(flash_reduction_enabled() && !get_qr(qr_WAVY_NO_EPILEPSY_2)) amp2*=2; |
| 3568 | 32028 | int32_t i=frame%amp2; | |
| 3569 | |||
| 3570 |
2/2✓ Branch 0 taken 5382552 times.
✓ Branch 1 taken 32028 times.
|
5414580 | for(int32_t j=0; j<viewport.visible_height(show_bottom_8px); j++) |
| 3571 | { | ||
| 3572 |
3/4✓ Branch 0 taken 2691276 times.
✓ Branch 1 taken 2691276 times.
✓ Branch 2 taken 2691276 times.
✗ Branch 3 not taken.
|
5382552 | if(j&1 && interpol) |
| 3573 | { | ||
| 3574 | // Add 288*2048 to ensure it's never negative. It'll get modded out. | ||
| 3575 | ✗ | ofs=288*2048+int32_t(zc::math::Sin((double(i+j)*2*PI/amp2))*amplitude); | |
| 3576 | ✗ | } | |
| 3577 | else | ||
| 3578 | { | ||
| 3579 | 5382552 | ofs=288*2048-int32_t(zc::math::Sin((double(i+j)*2*PI/amp2))*amplitude); | |
| 3580 | } | ||
| 3581 | |||
| 3582 |
1/2✓ Branch 0 taken 5382552 times.
✗ Branch 1 not taken.
|
5382552 | if(ofs) |
| 3583 | { | ||
| 3584 |
2/2✓ Branch 0 taken 1377933312 times.
✓ Branch 1 taken 5382552 times.
|
1383315864 | for(int32_t k=0; k<256; k++) |
| 3585 | { | ||
| 3586 | 1377933312 | target->line[j+original_playing_field_offset][k]=wavebuf->line[j][(k+ofs+16)%288]; | |
| 3587 | 1377933312 | } | |
| 3588 | 5382552 | } | |
| 3589 | 5382552 | } | |
| 3590 | 32028 | } | |
| 3591 | |||
| 3592 | 28272 | void draw_fuzzy(int32_t fuzz) | |
| 3593 | // draws from right half of scrollbuf to framebuf | ||
| 3594 | { | ||
| 3595 | int32_t firstx, firsty, xstep, ystep, i, y, dx, dy; | ||
| 3596 | byte *start, *si, *di; | ||
| 3597 | |||
| 3598 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28272 times.
|
28272 | if(fuzz<1) |
| 3599 | ✗ | fuzz = 1; | |
| 3600 | |||
| 3601 | 28272 | xstep = 128%fuzz; | |
| 3602 | |||
| 3603 |
2/2✓ Branch 0 taken 5890 times.
✓ Branch 1 taken 22382 times.
|
28272 | if(xstep > 0) |
| 3604 | 22382 | xstep = fuzz-xstep; | |
| 3605 | |||
| 3606 | 28272 | ystep = 112%fuzz; | |
| 3607 | |||
| 3608 |
2/2✓ Branch 0 taken 8246 times.
✓ Branch 1 taken 20026 times.
|
28272 | if(ystep > 0) |
| 3609 | 20026 | ystep = fuzz-ystep; | |
| 3610 | |||
| 3611 | 28272 | firsty = 1; | |
| 3612 | |||
| 3613 |
2/2✓ Branch 0 taken 28272 times.
✓ Branch 1 taken 1020148 times.
|
1048420 | for(y=0; y<framebuf->h;) |
| 3614 | { | ||
| 3615 | 1020148 | start = &(scrollbuf_old->line[y][256]); | |
| 3616 | |||
| 3617 |
4/4✓ Branch 0 taken 1006012 times.
✓ Branch 1 taken 6347064 times.
✓ Branch 2 taken 6332928 times.
✓ Branch 3 taken 1020148 times.
|
7353076 | for(dy=0; dy<ystep && dy+y<framebuf->h; dy++) |
| 3618 | { | ||
| 3619 | 6332928 | si = start; | |
| 3620 | 6332928 | di = &(framebuf->line[y+dy][0]); | |
| 3621 | 6332928 | i = xstep; | |
| 3622 | 6332928 | firstx = 1; | |
| 3623 | |||
| 3624 |
2/2✓ Branch 0 taken 1621229568 times.
✓ Branch 1 taken 6332928 times.
|
1627562496 | for(dx=0; dx<framebuf->w; dx++) |
| 3625 | { | ||
| 3626 | 1621229568 | *(di++) = *si; | |
| 3627 | |||
| 3628 |
2/2✓ Branch 0 taken 1366065344 times.
✓ Branch 1 taken 255164224 times.
|
1621229568 | if(++i >= fuzz) |
| 3629 | { | ||
| 3630 |
2/2✓ Branch 0 taken 248831296 times.
✓ Branch 1 taken 6332928 times.
|
255164224 | if(!firstx) |
| 3631 | 248831296 | si += fuzz; | |
| 3632 | else | ||
| 3633 | { | ||
| 3634 | 6332928 | si += fuzz-xstep; | |
| 3635 | 6332928 | firstx = 0; | |
| 3636 | } | ||
| 3637 | |||
| 3638 | 255164224 | i = 0; | |
| 3639 | 255164224 | } | |
| 3640 | 1621229568 | } | |
| 3641 | 6332928 | } | |
| 3642 | |||
| 3643 |
2/2✓ Branch 0 taken 991876 times.
✓ Branch 1 taken 28272 times.
|
1020148 | if(!firsty) |
| 3644 | 991876 | y += fuzz; | |
| 3645 | else | ||
| 3646 | { | ||
| 3647 | 28272 | y += ystep; | |
| 3648 | 28272 | ystep = fuzz; | |
| 3649 | 28272 | firsty = 0; | |
| 3650 | } | ||
| 3651 | } | ||
| 3652 | 28272 | } | |
| 3653 | |||
| 3654 | 19231110 | void updatescr(bool allowwavy) | |
| 3655 | { | ||
| 3656 |
4/6✓ Branch 0 taken 323 times.
✓ Branch 1 taken 19230787 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 323 times.
✓ Branch 4 taken 323 times.
✗ Branch 5 not taken.
|
19231110 | static BITMAP *wavybuf = create_bitmap_ex(8, framebuf->w, framebuf->h); |
| 3657 |
4/6✓ Branch 0 taken 323 times.
✓ Branch 1 taken 19230787 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 323 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 323 times.
|
19231110 | static BITMAP *panorama = create_bitmap_ex(8, framebuf->w, framebuf->h); |
| 3658 | 19231110 | update_bmp_size(&wavybuf, framebuf->w, framebuf->h); | |
| 3659 | 19231110 | update_bmp_size(&panorama, framebuf->w, framebuf->h); | |
| 3660 | |||
| 3661 |
2/2✓ Branch 0 taken 19202969 times.
✓ Branch 1 taken 28141 times.
|
19231110 | if(walk_through_walls) |
| 3662 | { | ||
| 3663 | 28141 | textout_ex(framebuf,font,"no walls",8,216,1,-1); | |
| 3664 | 28141 | } | |
| 3665 | |||
| 3666 |
1/2✓ Branch 0 taken 19231110 times.
✗ Branch 1 not taken.
|
19231110 | if(Showpal) |
| 3667 | ✗ | dump_pal(framebuf); | |
| 3668 | |||
| 3669 |
2/2✓ Branch 0 taken 18706947 times.
✓ Branch 1 taken 524163 times.
|
19231110 | if(!Playing) |
| 3670 | 524163 | black_opening_count=0; | |
| 3671 | |||
| 3672 |
2/2✓ Branch 0 taken 19053180 times.
✓ Branch 1 taken 177930 times.
|
19231110 | if(black_opening_count<0) //shape is opening up |
| 3673 | { | ||
| 3674 | 177930 | black_opening(framebuf,black_opening_x,black_opening_y,(66+black_opening_count),66); | |
| 3675 | |||
| 3676 |
2/4✓ Branch 0 taken 177930 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 177930 times.
|
177930 | if(Advance||(!Paused)) |
| 3677 | { | ||
| 3678 | 177930 | ++black_opening_count; | |
| 3679 | 177930 | } | |
| 3680 | 177930 | } | |
| 3681 |
2/2✓ Branch 0 taken 19004340 times.
✓ Branch 1 taken 48840 times.
|
19053180 | else if(black_opening_count>0) //shape is closing |
| 3682 | { | ||
| 3683 | 48840 | black_opening(framebuf,black_opening_x,black_opening_y,black_opening_count,66); | |
| 3684 | |||
| 3685 |
2/4✓ Branch 0 taken 48840 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48840 times.
|
48840 | if(Advance||(!Paused)) |
| 3686 | { | ||
| 3687 | 48840 | --black_opening_count; | |
| 3688 | 48840 | } | |
| 3689 | 48840 | } | |
| 3690 | |||
| 3691 |
3/4✓ Branch 0 taken 19007774 times.
✓ Branch 1 taken 223336 times.
✓ Branch 2 taken 19007774 times.
✗ Branch 3 not taken.
|
19231110 | if(black_opening_count==0&&black_opening_shape==bosFADEBLACK) |
| 3692 | { | ||
| 3693 | ✗ | black_opening_shape = bosCIRCLE; | |
| 3694 | ✗ | memcpy(RAMpal, tempblackpal, PAL_SIZE*sizeof(RGB)); | |
| 3695 | ✗ | refreshTints(); | |
| 3696 | ✗ | refreshpal=true; | |
| 3697 | ✗ | } | |
| 3698 | |||
| 3699 |
2/2✓ Branch 0 taken 18595651 times.
✓ Branch 1 taken 635459 times.
|
19231110 | if(refreshpal) |
| 3700 | { | ||
| 3701 | 635459 | refreshpal=false; | |
| 3702 | 635459 | RAMpal[253] = _RGB(0,0,0); | |
| 3703 | 635459 | RAMpal[254] = _RGB(255,255,255); | |
| 3704 | 635459 | hw_palette = &RAMpal; | |
| 3705 | 635459 | update_hw_pal = true; | |
| 3706 | 635459 | refresh_rgb_tables(); | |
| 3707 | 635459 | } | |
| 3708 | |||
| 3709 | 19231110 | bool clearwavy = (wavy <= 0); | |
| 3710 | |||
| 3711 |
2/2✓ Branch 0 taken 8572 times.
✓ Branch 1 taken 19222538 times.
|
19231110 | if(wavy <= 0) |
| 3712 | { | ||
| 3713 | // So far one thing can alter wavy apart from scripts: Wavy DMaps. | ||
| 3714 | 19222538 | wavy = (DMaps[cur_dmap].flags&dmfWAVY ? 4 : 0); | |
| 3715 | 19222538 | } | |
| 3716 | |||
| 3717 | 19231110 | blit(framebuf, wavybuf, 0, 0, 0, 0, framebuf->w, framebuf->h); | |
| 3718 | |||
| 3719 |
6/6✓ Branch 0 taken 32278 times.
✓ Branch 1 taken 19198832 times.
✓ Branch 2 taken 32156 times.
✓ Branch 3 taken 122 times.
✓ Branch 4 taken 128 times.
✓ Branch 5 taken 32028 times.
|
19231110 | if(wavy && Playing && allowwavy) |
| 3720 | { | ||
| 3721 | 32028 | draw_wavy(framebuf, wavybuf, wavy,false); | |
| 3722 | 32028 | } | |
| 3723 | |||
| 3724 |
2/2✓ Branch 0 taken 19222538 times.
✓ Branch 1 taken 8572 times.
|
19231110 | if(clearwavy) |
| 3725 | 19222538 | wavy = 0; // Wavy was set by a DMap flag. Clear it. | |
| 3726 |
2/4✓ Branch 0 taken 8572 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8572 times.
|
8572 | else if(Playing && !Paused) |
| 3727 | 8572 | wavy--; // Wavy was set by a script. Decrement it. | |
| 3728 | |||
| 3729 |
3/4✓ Branch 0 taken 18706947 times.
✓ Branch 1 taken 524163 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18706947 times.
|
19231110 | if(Playing && !Paused) |
| 3730 | 18706947 | ++light_wave_clk; | |
| 3731 | |||
| 3732 |
6/6✓ Branch 0 taken 18706947 times.
✓ Branch 1 taken 524163 times.
✓ Branch 2 taken 277275 times.
✓ Branch 3 taken 18429672 times.
✓ Branch 4 taken 68 times.
✓ Branch 5 taken 277207 times.
|
19231110 | if(Playing && msg_active && !screenscrolling) |
| 3733 | { | ||
| 3734 |
2/2✓ Branch 0 taken 133 times.
✓ Branch 1 taken 277074 times.
|
277207 | if(!(msg_bg_display_buf->clip)) |
| 3735 | 277074 | blit_msgstr_bg(framebuf,0,0,0,playing_field_offset,256,176); | |
| 3736 |
2/2✓ Branch 0 taken 133 times.
✓ Branch 1 taken 277074 times.
|
277207 | if(!(msg_portrait_display_buf->clip)) |
| 3737 | 277074 | blit_msgstr_prt(framebuf,0,0,0,playing_field_offset,256,176); | |
| 3738 |
2/2✓ Branch 0 taken 133 times.
✓ Branch 1 taken 277074 times.
|
277207 | if(!(msg_txt_display_buf->clip)) |
| 3739 | 277074 | blit_msgstr_fg(framebuf,0,0,0,playing_field_offset,256,176); | |
| 3740 | 277207 | } | |
| 3741 | |||
| 3742 |
3/4✓ Branch 0 taken 19231110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19025043 times.
✓ Branch 3 taken 206067 times.
|
19231110 | bool nosubscr = GameLoaded && no_subscreen() && !(hero_scr->flags3&fNOSUBSCROFFSET); |
| 3743 | |||
| 3744 |
2/2✓ Branch 0 taken 19030316 times.
✓ Branch 1 taken 200794 times.
|
19231110 | if(nosubscr) |
| 3745 | { | ||
| 3746 | 200794 | clear_to_color(panorama, 0); | |
| 3747 | 200794 | blit(wavybuf,panorama,0,playing_field_offset,0,playing_field_offset/2,256,framebuf->h-playing_field_offset); | |
| 3748 | 200794 | } | |
| 3749 | |||
| 3750 | //TODO: Optimize blit 'overcalls' -Gleeok | ||
| 3751 |
2/2✓ Branch 0 taken 200794 times.
✓ Branch 1 taken 19030316 times.
|
19231110 | BITMAP *source = nosubscr ? panorama : wavybuf; |
| 3752 | 19231110 | blit(source, framebuf, 0, 0, 0, 0, framebuf->w, framebuf->h); | |
| 3753 | |||
| 3754 | 19231110 | update_hw_screen(); | |
| 3755 | 19231110 | } | |
| 3756 | |||
| 3757 | //---------------------------------------------------------------- | ||
| 3758 | |||
| 3759 | static PALETTE syspal; | ||
| 3760 | ✗ | int32_t onGUISnapshot() | |
| 3761 | { | ||
| 3762 | char buf[200]; | ||
| 3763 | ✗ | int32_t num=0; | |
| 3764 | ✗ | do | |
| 3765 | { | ||
| 3766 | ✗ | sprintf(buf, "%szc_screen%05d.%s", get_snap_str(), ++num, snapshotformat_str[SnapshotFormat][1]); | |
| 3767 | ✗ | } | |
| 3768 | ✗ | while(num<99999 && exists(buf)); | |
| 3769 | |||
| 3770 | ✗ | if (!al_save_bitmap(buf, al_get_backbuffer(all_get_display()))) | |
| 3771 | ✗ | InfoDialog("Error", "Failed to save snapshot").show(); | |
| 3772 | |||
| 3773 | ✗ | return D_O_K; | |
| 3774 | ✗ | } | |
| 3775 | |||
| 3776 | ✗ | int32_t onNonGUISnapshot() | |
| 3777 | { | ||
| 3778 | PALETTE temppal; | ||
| 3779 | ✗ | get_palette(temppal); | |
| 3780 | ✗ | bool realpal=(zc_getkey(KEY_ZC_LCONTROL, true) || zc_getkey(KEY_ZC_RCONTROL, true)); | |
| 3781 | |||
| 3782 | char buf[200]; | ||
| 3783 | ✗ | int32_t num=0; | |
| 3784 | |||
| 3785 | ✗ | do | |
| 3786 | { | ||
| 3787 | ✗ | sprintf(buf, "%szc_screen%05d.%s", get_snap_str(), ++num, snapshotformat_str[SnapshotFormat][1]); | |
| 3788 | ✗ | } | |
| 3789 | ✗ | while(num<99999 && exists(buf)); | |
| 3790 | |||
| 3791 | ✗ | if (hero_scr && no_subscreen() && !(hero_scr->flags3&fNOSUBSCROFFSET) && !key[KEY_ALT]) | |
| 3792 | { | ||
| 3793 | ✗ | BITMAP *b = create_bitmap_ex(8, 256, viewport.visible_height(show_bottom_8px)); | |
| 3794 | ✗ | clear_to_color(b,0); | |
| 3795 | ✗ | blit(framebuf,b,0,playing_field_offset/2,0,0,b->w,b->h); | |
| 3796 | ✗ | alleg4_save_bitmap(b, SnapshotScale, buf, realpal ? temppal : RAMpal); | |
| 3797 | ✗ | destroy_bitmap(b); | |
| 3798 | ✗ | } | |
| 3799 | else | ||
| 3800 | { | ||
| 3801 | ✗ | alleg4_save_bitmap(framebuf, SnapshotScale, buf, realpal?temppal:RAMpal); | |
| 3802 | } | ||
| 3803 | |||
| 3804 | ✗ | return D_O_K; | |
| 3805 | } | ||
| 3806 | |||
| 3807 | ✗ | int32_t onSnapshot() | |
| 3808 | { | ||
| 3809 | ✗ | if(zc_getkey(KEY_LSHIFT, true)||zc_getkey(KEY_RSHIFT, true)) | |
| 3810 | { | ||
| 3811 | ✗ | onGUISnapshot(); | |
| 3812 | ✗ | } | |
| 3813 | else | ||
| 3814 | { | ||
| 3815 | ✗ | onNonGUISnapshot(); | |
| 3816 | } | ||
| 3817 | |||
| 3818 | ✗ | return D_O_K; | |
| 3819 | } | ||
| 3820 | |||
| 3821 | ✗ | int32_t onSaveMapPic() | |
| 3822 | { | ||
| 3823 | char buf[200]; | ||
| 3824 | ✗ | int32_t num=0; | |
| 3825 | ✗ | BITMAP* _screen_draw_buffer = NULL; | |
| 3826 | ✗ | _screen_draw_buffer = create_bitmap_ex(8,256,176); | |
| 3827 | |||
| 3828 | ✗ | do | |
| 3829 | { | ||
| 3830 | ✗ | sprintf(buf, "%szc_screen%05d.png", get_snap_str(), ++num); | |
| 3831 | ✗ | } | |
| 3832 | ✗ | while(num<99999 && exists(buf)); | |
| 3833 | |||
| 3834 | ✗ | BITMAP* mappic = create_bitmap_ex(8,(256*16),(176*8)); | |
| 3835 | ✗ | clear_to_color(mappic, BLACK); | |
| 3836 | |||
| 3837 | ✗ | if(!mappic) | |
| 3838 | { | ||
| 3839 | ✗ | enter_sys_pal(); | |
| 3840 | ✗ | jwin_alert("View Map","Not enough memory.",NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 3841 | ✗ | exit_sys_pal(); | |
| 3842 | ✗ | return D_O_K;; | |
| 3843 | } | ||
| 3844 | |||
| 3845 | ✗ | clear_to_color(_screen_draw_buffer, BLACK); | |
| 3846 | |||
| 3847 | ✗ | auto prev_viewport = viewport; | |
| 3848 | ✗ | viewport.x = 0; | |
| 3849 | ✗ | viewport.y = 0; | |
| 3850 | |||
| 3851 | // draw the map | ||
| 3852 | |||
| 3853 | ✗ | bool classic_draw = get_qr(qr_CLASSIC_DRAWING_ORDER); | |
| 3854 | ✗ | for(int32_t y=0; y<8; y++) | |
| 3855 | { | ||
| 3856 | ✗ | for(int32_t x=0; x<16; x++) | |
| 3857 | { | ||
| 3858 | ✗ | if (!displayOnMap(x, y)) | |
| 3859 | ✗ | continue; | |
| 3860 | |||
| 3861 | ✗ | int screen = map_scr_xy_to_index(x, y); | |
| 3862 | ✗ | auto scrs = loadscr2(screen); | |
| 3863 | ✗ | mapscr* scr = &scrs[0]; | |
| 3864 | ✗ | if (!scr->is_valid()) | |
| 3865 | ✗ | continue; | |
| 3866 | |||
| 3867 | screen_handles_t screen_handles; | ||
| 3868 | ✗ | for (int i = 0; i <= 6; i++) | |
| 3869 | ✗ | screen_handles[i] = {scr, scrs[i].is_valid() ? &scrs[i] : nullptr, screen, i}; | |
| 3870 | |||
| 3871 | ✗ | int xx = 0; | |
| 3872 | ✗ | int yy = -playing_field_offset; | |
| 3873 | |||
| 3874 | ✗ | if (!classic_draw) | |
| 3875 | ✗ | for (int layer = -7; layer <= -4; ++layer) | |
| 3876 | ✗ | do_ffc_layer(_screen_draw_buffer, layer, screen_handles[0], xx, yy); | |
| 3877 | |||
| 3878 | ✗ | if(classic_draw) | |
| 3879 | { | ||
| 3880 | ✗ | if(XOR(scr->flags7&fLAYER2BG, DMaps[cur_dmap].flags&dmfLAYER2BG)) | |
| 3881 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[2], xx, yy); | |
| 3882 | ✗ | do_ffc_layer(_screen_draw_buffer, -2, screen_handles[0], xx, yy); | |
| 3883 | ✗ | } | |
| 3884 | |||
| 3885 | ✗ | if(XOR(scr->flags7&fLAYER3BG, DMaps[cur_dmap].flags&dmfLAYER3BG)) | |
| 3886 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[3], xx, yy); | |
| 3887 | ✗ | do_ffc_layer(_screen_draw_buffer, -3, screen_handles[0], xx, yy); | |
| 3888 | |||
| 3889 | ✗ | if(!classic_draw) | |
| 3890 | { | ||
| 3891 | ✗ | if(XOR(scr->flags7&fLAYER2BG, DMaps[cur_dmap].flags&dmfLAYER2BG)) | |
| 3892 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[2], xx, yy); | |
| 3893 | ✗ | do_ffc_layer(_screen_draw_buffer, -2, screen_handles[0], xx, yy); | |
| 3894 | ✗ | do_ffc_layer(_screen_draw_buffer, -1, screen_handles[0], xx, yy); | |
| 3895 | ✗ | } | |
| 3896 | |||
| 3897 | ✗ | if(lenscheck(scr,0)) | |
| 3898 | ✗ | putscr(scr, _screen_draw_buffer, 0, 0); | |
| 3899 | ✗ | do_ffc_layer(_screen_draw_buffer, 0, screen_handles[0], xx, yy); | |
| 3900 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[1], xx, yy); | |
| 3901 | ✗ | do_ffc_layer(_screen_draw_buffer, 1, screen_handles[0], xx, yy); | |
| 3902 | |||
| 3903 | ✗ | if(!XOR(scr->flags7&fLAYER2BG, DMaps[cur_dmap].flags&dmfLAYER2BG)) | |
| 3904 | { | ||
| 3905 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[2], xx, yy); | |
| 3906 | ✗ | do_ffc_layer(_screen_draw_buffer, 2, screen_handles[0], xx, yy); | |
| 3907 | ✗ | } | |
| 3908 | |||
| 3909 | ✗ | putscrdoors(scr, _screen_draw_buffer, xx, yy); | |
| 3910 | ✗ | if(get_qr(qr_PUSHBLOCK_SPRITE_LAYER)) | |
| 3911 | { | ||
| 3912 | ✗ | do_layer(_screen_draw_buffer, -2, screen_handles[0], xx, yy); | |
| 3913 | ✗ | if(get_qr(qr_PUSHBLOCK_LAYER_1_2)) | |
| 3914 | { | ||
| 3915 | ✗ | do_layer(_screen_draw_buffer, -2, screen_handles[1], xx, yy); | |
| 3916 | ✗ | do_layer(_screen_draw_buffer, -2, screen_handles[2], xx, yy); | |
| 3917 | ✗ | } | |
| 3918 | ✗ | } | |
| 3919 | |||
| 3920 | ✗ | if(!XOR(scr->flags7&fLAYER3BG, DMaps[cur_dmap].flags&dmfLAYER3BG)) | |
| 3921 | { | ||
| 3922 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[3], xx, yy); | |
| 3923 | ✗ | do_ffc_layer(_screen_draw_buffer, 3, screen_handles[0], xx, yy); | |
| 3924 | ✗ | } | |
| 3925 | |||
| 3926 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[4], xx, yy); | |
| 3927 | ✗ | do_ffc_layer(_screen_draw_buffer, 4, screen_handles[0], xx, yy); | |
| 3928 | ✗ | do_layer(_screen_draw_buffer, -1, screen_handles[0], xx, yy); | |
| 3929 | ✗ | if(get_qr(qr_OVERHEAD_COMBOS_L1_L2)) | |
| 3930 | { | ||
| 3931 | ✗ | do_layer(_screen_draw_buffer, -1, screen_handles[1], xx, yy); | |
| 3932 | ✗ | do_layer(_screen_draw_buffer, -1, screen_handles[2], xx, yy); | |
| 3933 | ✗ | } | |
| 3934 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[5], xx, yy); | |
| 3935 | ✗ | do_ffc_layer(_screen_draw_buffer, 5, screen_handles[0], xx, yy); | |
| 3936 | ✗ | if(replay_version_check(40)) | |
| 3937 | ✗ | do_ffc_layer(_screen_draw_buffer, -1000, screen_handles[0], xx, yy); | |
| 3938 | ✗ | do_layer(_screen_draw_buffer, 0, screen_handles[6], xx, yy); | |
| 3939 | ✗ | do_ffc_layer(_screen_draw_buffer, 6, screen_handles[0], xx, yy); | |
| 3940 | ✗ | do_ffc_layer(_screen_draw_buffer, 7, screen_handles[0], xx, yy); | |
| 3941 | |||
| 3942 | ✗ | blit(_screen_draw_buffer, mappic, 0, 0, x*256, y*176, 256, 176); | |
| 3943 | ✗ | } | |
| 3944 | ✗ | } | |
| 3945 | |||
| 3946 | ✗ | viewport = prev_viewport; | |
| 3947 | ✗ | save_bitmap(buf,mappic,RAMpal); | |
| 3948 | ✗ | destroy_bitmap(mappic); | |
| 3949 | ✗ | destroy_bitmap(_screen_draw_buffer); | |
| 3950 | ✗ | return D_O_K; | |
| 3951 | ✗ | } | |
| 3952 | |||
| 3953 | 59 | void f_Quit(int32_t type) | |
| 3954 | { | ||
| 3955 |
2/4✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
|
59 | if(type==qQUIT && !Playing) |
| 3956 | ✗ | return; | |
| 3957 | |||
| 3958 | 59 | bool from_menu = is_sys_pal; | |
| 3959 | |||
| 3960 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(!from_menu) |
| 3961 | { | ||
| 3962 | 59 | music_pause(); | |
| 3963 | 59 | pause_all_sfx(); | |
| 3964 | 59 | sys_mouse(); | |
| 3965 | 59 | } | |
| 3966 | 59 | enter_sys_pal(); | |
| 3967 | 59 | clear_keybuf(); | |
| 3968 | |||
| 3969 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 13 times.
|
59 | if (replay_version_check(0, 10)) |
| 3970 | 13 | replay_poll(); | |
| 3971 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if (replay_is_replaying()) |
| 3972 | 59 | replay_peek_quit(); | |
| 3973 | |||
| 3974 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if (!replay_is_replaying()) |
| 3975 | ✗ | switch(type) | |
| 3976 | { | ||
| 3977 | case qQUIT: | ||
| 3978 | ✗ | onQuit(); | |
| 3979 | ✗ | break; | |
| 3980 | |||
| 3981 | case qRESET: | ||
| 3982 | ✗ | onReset(); | |
| 3983 | ✗ | break; | |
| 3984 | |||
| 3985 | case qEXIT: | ||
| 3986 | ✗ | onExit(); | |
| 3987 | ✗ | break; | |
| 3988 | ✗ | } | |
| 3989 | |||
| 3990 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(Quit) |
| 3991 | { | ||
| 3992 | 59 | kill_sfx(); | |
| 3993 | 59 | music_stop(); | |
| 3994 | 59 | exit_sys_pal(); | |
| 3995 | 59 | update_hw_screen(); | |
| 3996 | 59 | } | |
| 3997 | else | ||
| 3998 | { | ||
| 3999 | ✗ | exit_sys_pal(); | |
| 4000 | ✗ | if(!from_menu) | |
| 4001 | { | ||
| 4002 | ✗ | music_resume(); | |
| 4003 | ✗ | resume_all_sfx(); | |
| 4004 | ✗ | } | |
| 4005 | } | ||
| 4006 | |||
| 4007 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(!from_menu) |
| 4008 | 59 | game_mouse(); | |
| 4009 | 59 | eat_buttons(); | |
| 4010 | |||
| 4011 | 59 | zc_readrawkey(KEY_ESC); | |
| 4012 | |||
| 4013 | 59 | zc_readrawkey(KEY_ENTER); | |
| 4014 | 59 | } | |
| 4015 | |||
| 4016 | //---------------------------------------------------------------- | ||
| 4017 | |||
| 4018 | ✗ | int32_t onNoWalls() | |
| 4019 | { | ||
| 4020 | ✗ | cheats_enqueue(Cheat::Walls); | |
| 4021 | ✗ | return D_O_K; | |
| 4022 | ✗ | } | |
| 4023 | |||
| 4024 | ✗ | int32_t onIgnoreSideview() | |
| 4025 | { | ||
| 4026 | ✗ | cheats_enqueue(Cheat::IgnoreSideView); | |
| 4027 | ✗ | return D_O_K; | |
| 4028 | ✗ | } | |
| 4029 | |||
| 4030 | 19229703 | int32_t input_idle(bool checkmouse) | |
| 4031 | { | ||
| 4032 | static int32_t mx, my, mz, mb; | ||
| 4033 | |||
| 4034 |
4/6✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5123906 times.
✓ Branch 3 taken 14105797 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5123906 times.
|
24353609 | if(keypressed() || zc_key_pressed() || |
| 4035 |
4/8✓ Branch 0 taken 5123906 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5123906 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5123906 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5123906 times.
✗ Branch 7 not taken.
|
5123906 | (checkmouse && (mx != mouse_x || my != mouse_y || mz != mouse_z || mb != mouse_b))) |
| 4036 | { | ||
| 4037 | 14105797 | idle_count = 0; | |
| 4038 | |||
| 4039 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14105797 times.
|
14105797 | if(active_count < MAX_ACTIVE) |
| 4040 | { | ||
| 4041 | 14105797 | ++active_count; | |
| 4042 | 14105797 | } | |
| 4043 | 14105797 | } | |
| 4044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5123906 times.
|
5123906 | else if(idle_count < MAX_IDLE) |
| 4045 | { | ||
| 4046 | 5123906 | ++idle_count; | |
| 4047 | 5123906 | active_count = 0; | |
| 4048 | 5123906 | } | |
| 4049 | |||
| 4050 | 19229703 | mx = mouse_x; | |
| 4051 | 19229703 | my = mouse_y; | |
| 4052 | 19229703 | mz = mouse_z; | |
| 4053 | 19229703 | mb = mouse_b; | |
| 4054 | |||
| 4055 | 19229703 | return idle_count; | |
| 4056 | } | ||
| 4057 | |||
| 4058 | ✗ | int32_t onGoFast() | |
| 4059 | { | ||
| 4060 | ✗ | cheats_enqueue(Cheat::Fast); | |
| 4061 | ✗ | return D_O_K; | |
| 4062 | ✗ | } | |
| 4063 | |||
| 4064 | ✗ | int32_t onKillCheat() | |
| 4065 | { | ||
| 4066 | ✗ | cheats_enqueue(Cheat::Kill); | |
| 4067 | ✗ | return D_O_K; | |
| 4068 | ✗ | } | |
| 4069 | |||
| 4070 | ✗ | int32_t onSecretsCheat() | |
| 4071 | { | ||
| 4072 | ✗ | cheats_enqueue(Cheat::TrigSecrets); | |
| 4073 | ✗ | return D_O_K; | |
| 4074 | ✗ | } | |
| 4075 | ✗ | int32_t onSecretsCheatPerm() | |
| 4076 | { | ||
| 4077 | ✗ | cheats_enqueue(Cheat::TrigSecretsPerm); | |
| 4078 | ✗ | return D_O_K; | |
| 4079 | ✗ | } | |
| 4080 | |||
| 4081 | ✗ | int32_t onShowLayer0() | |
| 4082 | { | ||
| 4083 | ✗ | show_layers[0] = !show_layers[0]; | |
| 4084 | ✗ | return D_O_K; | |
| 4085 | } | ||
| 4086 | ✗ | int32_t onShowLayer1() | |
| 4087 | { | ||
| 4088 | ✗ | show_layers[1] = !show_layers[1]; | |
| 4089 | ✗ | return D_O_K; | |
| 4090 | } | ||
| 4091 | ✗ | int32_t onShowLayer2() | |
| 4092 | { | ||
| 4093 | ✗ | show_layers[2] = !show_layers[2]; | |
| 4094 | ✗ | return D_O_K; | |
| 4095 | } | ||
| 4096 | ✗ | int32_t onShowLayer3() | |
| 4097 | { | ||
| 4098 | ✗ | show_layers[3] = !show_layers[3]; | |
| 4099 | ✗ | return D_O_K; | |
| 4100 | } | ||
| 4101 | ✗ | int32_t onShowLayer4() | |
| 4102 | { | ||
| 4103 | ✗ | show_layers[4] = !show_layers[4]; | |
| 4104 | ✗ | return D_O_K; | |
| 4105 | } | ||
| 4106 | ✗ | int32_t onShowLayer5() | |
| 4107 | { | ||
| 4108 | ✗ | show_layers[5] = !show_layers[5]; | |
| 4109 | ✗ | return D_O_K; | |
| 4110 | } | ||
| 4111 | ✗ | int32_t onShowLayer6() | |
| 4112 | { | ||
| 4113 | ✗ | show_layers[6] = !show_layers[6]; | |
| 4114 | ✗ | return D_O_K; | |
| 4115 | } | ||
| 4116 | ✗ | int32_t onShowLayerO() | |
| 4117 | { | ||
| 4118 | ✗ | show_layer_over=!show_layer_over; | |
| 4119 | ✗ | return D_O_K; | |
| 4120 | } | ||
| 4121 | ✗ | int32_t onShowLayerP() | |
| 4122 | { | ||
| 4123 | ✗ | show_layer_push=!show_layer_push; | |
| 4124 | ✗ | return D_O_K; | |
| 4125 | } | ||
| 4126 | ✗ | int32_t onShowLayerS() | |
| 4127 | { | ||
| 4128 | ✗ | show_sprites=!show_sprites; | |
| 4129 | ✗ | return D_O_K; | |
| 4130 | } | ||
| 4131 | ✗ | int32_t onShowLayerF() | |
| 4132 | { | ||
| 4133 | ✗ | show_ffcs=!show_ffcs; | |
| 4134 | ✗ | return D_O_K; | |
| 4135 | } | ||
| 4136 | ✗ | int32_t onShowLayerW() | |
| 4137 | { | ||
| 4138 | ✗ | show_walkflags=!show_walkflags; | |
| 4139 | ✗ | if(show_walkflags) | |
| 4140 | ✗ | show_effectflags = false; | |
| 4141 | ✗ | return D_O_K; | |
| 4142 | } | ||
| 4143 | ✗ | int32_t onShowLayerE() | |
| 4144 | { | ||
| 4145 | ✗ | show_effectflags=!show_effectflags; | |
| 4146 | ✗ | if(show_effectflags) | |
| 4147 | ✗ | show_walkflags = false; | |
| 4148 | ✗ | return D_O_K; | |
| 4149 | } | ||
| 4150 | ✗ | int32_t onShowFFScripts() | |
| 4151 | { | ||
| 4152 | ✗ | show_ff_scripts=!show_ff_scripts; | |
| 4153 | ✗ | return D_O_K; | |
| 4154 | } | ||
| 4155 | 2 | int32_t onShowHitboxes() | |
| 4156 | { | ||
| 4157 | 2 | show_hitboxes=!show_hitboxes; | |
| 4158 | 2 | return D_O_K; | |
| 4159 | } | ||
| 4160 | ✗ | int32_t onShowInfoOpacity() | |
| 4161 | { | ||
| 4162 | ✗ | info_opacity = vbound(getnumber("Debug Info Opacity",info_opacity),0,255); | |
| 4163 | ✗ | zc_set_config("zc","debug_info_opacity",info_opacity); | |
| 4164 | ✗ | return D_O_K; | |
| 4165 | } | ||
| 4166 | |||
| 4167 | ✗ | int32_t onLightSwitch() | |
| 4168 | { | ||
| 4169 | ✗ | cheats_enqueue(Cheat::Light); | |
| 4170 | ✗ | return D_O_K; | |
| 4171 | ✗ | } | |
| 4172 | |||
| 4173 | int32_t onGoTo(); | ||
| 4174 | int32_t onGoToComplete(); | ||
| 4175 | |||
| 4176 | 19229703 | bool handle_close_btn_quit() | |
| 4177 | { | ||
| 4178 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(close_button_quit) |
| 4179 | { | ||
| 4180 | ✗ | close_button_quit=false; | |
| 4181 | ✗ | f_Quit(qEXIT); | |
| 4182 | ✗ | } | |
| 4183 | 19229703 | return (exiting_program = Quit==qEXIT); | |
| 4184 | } | ||
| 4185 | |||
| 4186 | 19229703 | void syskeys() | |
| 4187 | { | ||
| 4188 | 19229703 | update_system_keys(); | |
| 4189 | |||
| 4190 | int32_t oldtitle_version; | ||
| 4191 | |||
| 4192 | 19229703 | poll_joystick(); | |
| 4193 | |||
| 4194 | 19229703 | handle_close_btn_quit(); | |
| 4195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
|
19229703 | if(Quit == qEXIT) return; |
| 4196 | |||
| 4197 |
2/10✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19229703 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
19229703 | if(rMbtn() || (gui_mouse_b() && !mouse_down && ClickToFreeze &&!disableClickToFreeze)) |
| 4198 | { | ||
| 4199 | ✗ | System(); | |
| 4200 | ✗ | } | |
| 4201 | |||
| 4202 | 19229703 | mouse_down=gui_mouse_b(); | |
| 4203 | |||
| 4204 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(zc_read_system_key(KEY_F1)) |
| 4205 | { | ||
| 4206 | ✗ | if(zc_get_system_key(KEY_ZC_LCONTROL) || zc_get_system_key(KEY_ZC_RCONTROL)) | |
| 4207 | { | ||
| 4208 | ✗ | halt=!halt; | |
| 4209 | //zinit.subscreen=(zinit.subscreen+1)%ssdtMAX; | ||
| 4210 | ✗ | } | |
| 4211 | else | ||
| 4212 | { | ||
| 4213 | ✗ | Throttlefps=!Throttlefps; | |
| 4214 | ✗ | zc_set_config(cfg_sect,"throttlefps", (int32_t)Throttlefps); | |
| 4215 | } | ||
| 4216 | ✗ | } | |
| 4217 | |||
| 4218 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(zc_read_system_key(KEY_F2)) |
| 4219 | { | ||
| 4220 | ✗ | ShowFPS=!ShowFPS; | |
| 4221 | ✗ | zc_set_config(cfg_sect,"showfps",(int32_t)ShowFPS); | |
| 4222 | ✗ | } | |
| 4223 | |||
| 4224 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19229703 | if(zc_read_system_key(KEY_F3) && Playing) Paused=!Paused; |
| 4225 | |||
| 4226 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19229703 | if(zc_read_system_key(KEY_F4) && Playing) |
| 4227 | { | ||
| 4228 | ✗ | Paused=true; | |
| 4229 | ✗ | Advance=true; | |
| 4230 | ✗ | } | |
| 4231 | |||
| 4232 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(zc_read_system_key(KEY_F6)) onTryQuit(); |
| 4233 | |||
| 4234 | #ifndef ALLEGRO_MACOSX | ||
| 4235 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(zc_read_system_key(KEY_F9)) f_Quit(qRESET); |
| 4236 | |||
| 4237 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(zc_read_system_key(KEY_F10)) f_Quit(qEXIT); |
| 4238 | #else | ||
| 4239 | if(zc_read_system_key(KEY_F7)) f_Quit(qRESET); | ||
| 4240 | |||
| 4241 | if(zc_read_system_key(KEY_F8)) f_Quit(qEXIT); | ||
| 4242 | #endif | ||
| 4243 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
19229703 | if(zc_read_system_key(KEY_F5)&&(Playing && cur_screen<128 && DMaps[cur_dmap].flags&dmfVIEWMAP)) onSaveMapPic(); |
| 4244 | |||
| 4245 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if (zc_read_system_key(KEY_F12)) |
| 4246 | { | ||
| 4247 | ✗ | onSnapshot(); | |
| 4248 | ✗ | } | |
| 4249 | |||
| 4250 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19229703 | if(debug_enabled && zc_read_system_key(KEY_TAB)) |
| 4251 | ✗ | set_debug(!get_debug()); | |
| 4252 | |||
| 4253 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(CheatModifierKeys()) |
| 4254 | { | ||
| 4255 | ✗ | for(Cheat c = (Cheat)1; c < Cheat::Last; c = (Cheat)(c+1)) | |
| 4256 | { | ||
| 4257 | ✗ | if(!bindable_cheat(c)) | |
| 4258 | ✗ | continue; | |
| 4259 | ✗ | if(get_debug() || cheat >= cheat_lvl(c)) | |
| 4260 | { | ||
| 4261 | ✗ | if(checkcheat(c)) | |
| 4262 | ✗ | cheats_hit_bind(c); | |
| 4263 | ✗ | } | |
| 4264 | ✗ | } | |
| 4265 | ✗ | } | |
| 4266 | |||
| 4267 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(volkeys) |
| 4268 | { | ||
| 4269 | ✗ | if(zc_read_system_key(KEY_PGUP)) master_volume(-1,midi_volume+8); | |
| 4270 | |||
| 4271 | ✗ | if(zc_read_system_key(KEY_PGDN)) master_volume(-1,midi_volume==255?248:midi_volume-8); | |
| 4272 | |||
| 4273 | ✗ | if(zc_read_system_key(KEY_HOME)) master_volume(digi_volume+8,-1); | |
| 4274 | |||
| 4275 | ✗ | if(zc_read_system_key(KEY_END)) master_volume(digi_volume==255?248:digi_volume-8,-1); | |
| 4276 | ✗ | } | |
| 4277 | |||
| 4278 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19229703 | if(!get_debug() || !SystemKeys || replay_is_replaying()) |
| 4279 | 19229703 | goto bottom; | |
| 4280 | |||
| 4281 | ✗ | if(zc_readkey(KEY_P)) Paused=!Paused; | |
| 4282 | |||
| 4283 | ✗ | if(zc_readkey(KEY_A)) | |
| 4284 | { | ||
| 4285 | ✗ | Paused=true; | |
| 4286 | ✗ | Advance=true; | |
| 4287 | ✗ | } | |
| 4288 | |||
| 4289 | ✗ | if(zc_readkey(KEY_G)) db=(db==999)?0:999; | |
| 4290 | #ifndef ALLEGRO_MACOSX | ||
| 4291 | ✗ | if(zc_readkey(KEY_F8)) Showpal=!Showpal; | |
| 4292 | |||
| 4293 | ✗ | if(zc_readkey(KEY_F7)) | |
| 4294 | { | ||
| 4295 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 4296 | ✗ | game_pal(); | |
| 4297 | ✗ | } | |
| 4298 | #else | ||
| 4299 | // The reason these are different on Mac in the first place is that | ||
| 4300 | // the OS doesn't let us use F9 and F10... | ||
| 4301 | if(zc_readkey(KEY_F10)) Showpal=!Showpal; | ||
| 4302 | |||
| 4303 | if(zc_readkey(KEY_F9)) | ||
| 4304 | { | ||
| 4305 | Matrix(ss_speed, ss_density, 0); | ||
| 4306 | game_pal(); | ||
| 4307 | } | ||
| 4308 | #endif | ||
| 4309 | ✗ | if(zc_readkey(KEY_PLUS_PAD) || zc_readkey(KEY_EQUALS)) | |
| 4310 | { | ||
| 4311 | //change containers | ||
| 4312 | ✗ | if(zc_getkey(KEY_ZC_LCONTROL) || zc_getkey(KEY_ZC_RCONTROL)) | |
| 4313 | { | ||
| 4314 | //magic containers | ||
| 4315 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4316 | { | ||
| 4317 | ✗ | game->set_maxmagic(zc_min(game->get_maxmagic()+game->get_mp_per_block(),game->get_mp_per_block()*8)); | |
| 4318 | ✗ | } | |
| 4319 | else | ||
| 4320 | { | ||
| 4321 | ✗ | game->set_maxlife(zc_min(game->get_maxlife()+game->get_hp_per_heart(),game->get_hp_per_heart()*24)); | |
| 4322 | } | ||
| 4323 | ✗ | } | |
| 4324 | else | ||
| 4325 | { | ||
| 4326 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4327 | { | ||
| 4328 | ✗ | game->set_magic(zc_min(game->get_magic()+1,game->get_maxmagic())); | |
| 4329 | ✗ | } | |
| 4330 | else | ||
| 4331 | { | ||
| 4332 | ✗ | game->set_life(zc_min(game->get_life()+1,game->get_maxlife())); | |
| 4333 | } | ||
| 4334 | } | ||
| 4335 | ✗ | } | |
| 4336 | |||
| 4337 | ✗ | if(zc_readkey(KEY_MINUS_PAD) || zc_readkey(KEY_MINUS)) | |
| 4338 | { | ||
| 4339 | //change containers | ||
| 4340 | ✗ | if(zc_getkey(KEY_ZC_LCONTROL) || zc_getkey(KEY_ZC_RCONTROL)) | |
| 4341 | { | ||
| 4342 | //magic containers | ||
| 4343 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4344 | { | ||
| 4345 | ✗ | game->set_maxmagic(zc_max(game->get_maxmagic()-game->get_mp_per_block(),0)); | |
| 4346 | ✗ | game->set_magic(zc_min(game->get_maxmagic(), game->get_magic())); | |
| 4347 | //heart containers | ||
| 4348 | ✗ | } | |
| 4349 | else | ||
| 4350 | { | ||
| 4351 | ✗ | game->set_maxlife(zc_max(game->get_maxlife()-game->get_hp_per_heart(),game->get_hp_per_heart())); | |
| 4352 | ✗ | game->set_life(zc_min(game->get_maxlife(), game->get_life())); | |
| 4353 | } | ||
| 4354 | ✗ | } | |
| 4355 | else | ||
| 4356 | { | ||
| 4357 | ✗ | if(zc_getkey(KEY_LSHIFT) || zc_getkey(KEY_RSHIFT)) | |
| 4358 | { | ||
| 4359 | ✗ | game->set_magic(zc_max(game->get_magic()-1,0)); | |
| 4360 | ✗ | } | |
| 4361 | else | ||
| 4362 | { | ||
| 4363 | ✗ | game->set_life(zc_max(game->get_life()-1,0)); | |
| 4364 | } | ||
| 4365 | } | ||
| 4366 | ✗ | } | |
| 4367 | |||
| 4368 | ✗ | if(zc_readkey(KEY_COMMA)) jukebox(currmidi-1); | |
| 4369 | |||
| 4370 | ✗ | if(zc_readkey(KEY_STOP)) jukebox(currmidi+1); | |
| 4371 | |||
| 4372 | ✗ | verifyBothWeapons(); | |
| 4373 | |||
| 4374 | bottom: | ||
| 4375 | |||
| 4376 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(input_idle(true) > after_time()) |
| 4377 | { | ||
| 4378 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 4379 | ✗ | game_pal(); | |
| 4380 | ✗ | } | |
| 4381 | 19229703 | } | |
| 4382 | |||
| 4383 | 1531312 | void checkQuitKeys() | |
| 4384 | { | ||
| 4385 | #ifndef ALLEGRO_MACOSX | ||
| 4386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1531312 times.
|
1531312 | if(key[KEY_F9]) f_Quit(qRESET); |
| 4387 | |||
| 4388 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1531312 times.
|
1531312 | if(key[KEY_F10]) f_Quit(qEXIT); |
| 4389 | #else | ||
| 4390 | if(key[KEY_F7]) f_Quit(qRESET); | ||
| 4391 | |||
| 4392 | if(key[KEY_F8]) f_Quit(qEXIT); | ||
| 4393 | #endif | ||
| 4394 | 1531312 | } | |
| 4395 | |||
| 4396 | 19229903 | bool CheatModifierKeys() | |
| 4397 | { | ||
| 4398 | // Cheats are replayed via the X cheat step, no need to check for keyboard input | ||
| 4399 | // to trigger cheats. | ||
| 4400 |
2/2✓ Branch 0 taken 19229603 times.
✓ Branch 1 taken 300 times.
|
19229903 | if (replay_is_replaying()) |
| 4401 | 19229603 | return false; | |
| 4402 | |||
| 4403 |
3/4✓ Branch 0 taken 100 times.
✓ Branch 1 taken 200 times.
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
|
300 | if ( ( cheat_modifier_keys[0] > 0 && key[cheat_modifier_keys[0]] ) || |
| 4404 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 100 times.
|
200 | ( cheat_modifier_keys[1] > 0 && key[cheat_modifier_keys[1]] ) || |
| 4405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | (cheat_modifier_keys[0] <= 0 && cheat_modifier_keys[1] <= 0)) |
| 4406 | { | ||
| 4407 |
0/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
200 | if ( ( cheat_modifier_keys[2] <= 0 || key[cheat_modifier_keys[2]] ) || |
| 4408 | ✗ | ( cheat_modifier_keys[3] > 0 && key[cheat_modifier_keys[3]] ) || | |
| 4409 | ✗ | (cheat_modifier_keys[2] <= 0 && cheat_modifier_keys[3] <= 0)) | |
| 4410 | { | ||
| 4411 | ✗ | return true; | |
| 4412 | } | ||
| 4413 | ✗ | } | |
| 4414 | 100 | return false; | |
| 4415 | 19229703 | } | |
| 4416 | |||
| 4417 | //99:05:54, for some reason? | ||
| 4418 | #define OLDMAXTIME 21405240 | ||
| 4419 | //9000:00:00, the highest even-thousand hour fitting within 32b signed. This is 375 *DAYS*. | ||
| 4420 | #define MAXTIME 1944000000 | ||
| 4421 | |||
| 4422 | // (qr, value) | ||
| 4423 | 427 | static std::queue<std::pair<int, bool>> change_qr_queue; | |
| 4424 | |||
| 4425 | 7 | void enqueue_qr_change(int qr, bool value) | |
| 4426 | { | ||
| 4427 | 7 | change_qr_queue.push({qr, value}); | |
| 4428 | 7 | } | |
| 4429 | |||
| 4430 | // During regular play, QR changes issued through `syskey` / `System` and enqueued | ||
| 4431 | // and soon executed here. | ||
| 4432 | // During playing back a replay file, the replay system adds to the same queue and | ||
| 4433 | // is executed here too. | ||
| 4434 | // This is currently only used to allow users to configure qr_HIDE_BOTTOM_8_PIXELS, but | ||
| 4435 | // could be later extended to all QRs (perhaps as a cheat). | ||
| 4436 | 19230138 | void process_enqueued_qr_changes() | |
| 4437 | { | ||
| 4438 |
2/2✓ Branch 0 taken 101 times.
✓ Branch 1 taken 19230037 times.
|
19230138 | if (replay_is_replaying()) |
| 4439 | 19230037 | replay_do_qrs(); | |
| 4440 | |||
| 4441 |
2/2✓ Branch 0 taken 19230138 times.
✓ Branch 1 taken 7 times.
|
19230145 | while (!change_qr_queue.empty()) |
| 4442 | { | ||
| 4443 | 28 | auto [qr, value] = change_qr_queue.front(); | |
| 4444 | 7 | change_qr_queue.pop(); | |
| 4445 | |||
| 4446 | // Don't modify `quest_rules`, as that is used to store the canonical QR value which can be reset to | ||
| 4447 | // via system menus. Changing the unpacked array is enough to modify the engine's behavior. | ||
| 4448 | 14 | _qrs_unpacked[qr] = value; | |
| 4449 | 7 | apply_qr_rule(qr); | |
| 4450 | |||
| 4451 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1 times.
|
7 | if (replay_is_recording()) |
| 4452 | 2 | replay_step_qr(qr, value); | |
| 4453 | } | ||
| 4454 | 19230138 | } | |
| 4455 | |||
| 4456 | 19231110 | void advanceframe(bool allowwavy, bool sfxcleanup, bool allowF6Script) | |
| 4457 | { | ||
| 4458 |
1/2✓ Branch 0 taken 19231110 times.
✗ Branch 1 not taken.
|
19231110 | if(zcmusic!=NULL) |
| 4459 | { | ||
| 4460 | ✗ | zcmusic_poll(); | |
| 4461 | ✗ | } | |
| 4462 | 19231110 | zcmixer_update(zcmixer, emusic_volume, FFCore.usr_music_volume, get_qr(qr_OLD_SCRIPT_VOLUME)); | |
| 4463 | |||
| 4464 | 19231110 | updatescr(allowwavy); | |
| 4465 | |||
| 4466 | 19231110 | Advance=false; | |
| 4467 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 19231110 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 19231110 times.
|
19231110 | while(Paused && !Advance && !Quit) |
| 4468 | { | ||
| 4469 | // have to call this, otherwise we'll get an infinite loop | ||
| 4470 | ✗ | syskeys(); | |
| 4471 | ✗ | if(allowF6Script) | |
| 4472 | { | ||
| 4473 | ✗ | FFCore.runF6Engine(); | |
| 4474 | ✗ | } | |
| 4475 | |||
| 4476 | #ifdef _WIN32 | ||
| 4477 | |||
| 4478 | if(use_dwm_flush) | ||
| 4479 | { | ||
| 4480 | do_DwmFlush(); | ||
| 4481 | } | ||
| 4482 | |||
| 4483 | #endif | ||
| 4484 | |||
| 4485 | // to keep music playing | ||
| 4486 | ✗ | if(zcmusic!=NULL) | |
| 4487 | { | ||
| 4488 | ✗ | zcmusic_poll(); | |
| 4489 | ✗ | } | |
| 4490 | |||
| 4491 | ✗ | update_hw_screen(); | |
| 4492 | } | ||
| 4493 | |||
| 4494 |
2/2✓ Branch 0 taken 19229733 times.
✓ Branch 1 taken 1377 times.
|
19231110 | if(Quit) |
| 4495 | 1377 | return; | |
| 4496 | |||
| 4497 |
3/4✓ Branch 0 taken 18705897 times.
✓ Branch 1 taken 523836 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18705897 times.
|
19229733 | if(Playing && game->get_time()<unsigned(get_qr(qr_GREATER_MAX_TIME) ? MAXTIME : OLDMAXTIME)) |
| 4498 | 18705897 | game->change_time(1); | |
| 4499 | |||
| 4500 | // Many mistakes have been make re: inputs, and we are stuck with many replays relying on those mistakes. | ||
| 4501 | |||
| 4502 | 19229733 | bool should_reset_down_state = !get_qr(qr_BROKEN_INPUT_DOWN_STATE); | |
| 4503 |
2/2✓ Branch 0 taken 9430121 times.
✓ Branch 1 taken 9799612 times.
|
19229733 | if (replay_version_check(0, 16)) |
| 4504 | 9799612 | should_reset_down_state = replay_version_check(11, 16); | |
| 4505 |
2/2✓ Branch 0 taken 15096705 times.
✓ Branch 1 taken 4133028 times.
|
19229733 | if (should_reset_down_state) |
| 4506 | { | ||
| 4507 |
2/2✓ Branch 0 taken 74394504 times.
✓ Branch 1 taken 4133028 times.
|
78527532 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 4508 | 74394504 | down_control_states[i] = raw_control_state[i]; | |
| 4509 | 4133028 | } | |
| 4510 | |||
| 4511 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 19229703 times.
|
19229733 | if (replay_is_active()) |
| 4512 | { | ||
| 4513 |
2/2✓ Branch 0 taken 1545427 times.
✓ Branch 1 taken 17684276 times.
|
19229703 | if (replay_version_check(3)) |
| 4514 | 17684276 | replay_poll(); | |
| 4515 | |||
| 4516 |
4/4✓ Branch 0 taken 7478911 times.
✓ Branch 1 taken 11750792 times.
✓ Branch 2 taken 100535 times.
✓ Branch 3 taken 7378376 times.
|
19229703 | if (replay_version_check(11) || replay_version_check(6, 8)) |
| 4517 | 11851327 | replay_peek_input(); | |
| 4518 | 19229703 | } | |
| 4519 | |||
| 4520 | 19229733 | process_enqueued_qr_changes(); | |
| 4521 | |||
| 4522 | 19229733 | load_control_called_this_frame = false; | |
| 4523 | |||
| 4524 | 19229733 | poll_keyboard(); | |
| 4525 | 19229733 | update_keys(); | |
| 4526 | |||
| 4527 | 19229733 | ++frame; | |
| 4528 | |||
| 4529 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 19229603 times.
|
19229733 | if (replay_is_replaying()) |
| 4530 | 19229603 | replay_do_cheats(); | |
| 4531 | 19229733 | syskeys(); | |
| 4532 | |||
| 4533 | // The mouse variables can change from the mouse thread at anytime during a frame, | ||
| 4534 | // so save the result at the start so that replaying is consistent. | ||
| 4535 | 19229733 | script_mouse_x = gui_mouse_x(); | |
| 4536 | 19229733 | script_mouse_y = gui_mouse_y(); | |
| 4537 | 19229733 | script_mouse_z = mouse_z; | |
| 4538 | 19229733 | script_mouse_b = mouse_b; | |
| 4539 | |||
| 4540 | // Cheats used via the System menu (called by syskeys) will call cheats_enqueue. syskeys | ||
| 4541 | // is called just above, and in the paused loop above, so the queue-and-defer-slightly | ||
| 4542 | // approach here means it doesn't matter which call adds the cheat. | ||
| 4543 | 19229733 | cheats_execute_queued(); | |
| 4544 | |||
| 4545 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 19229603 times.
|
19229733 | if (replay_is_replaying()) |
| 4546 | 19229603 | replay_peek_quit(); | |
| 4547 |
2/2✓ Branch 0 taken 19229662 times.
✓ Branch 1 taken 71 times.
|
19229733 | if (GameFlags & GAMEFLAG_TRYQUIT) |
| 4548 | 71 | replay_step_quit(0); | |
| 4549 |
2/2✓ Branch 0 taken 3327 times.
✓ Branch 1 taken 19226406 times.
|
19229733 | if(allowF6Script) |
| 4550 | 19226406 | FFCore.runF6Engine(); | |
| 4551 |
2/2✓ Branch 0 taken 770 times.
✓ Branch 1 taken 19228963 times.
|
19229733 | if (Quit) |
| 4552 | 770 | replay_step_quit(Quit); | |
| 4553 | |||
| 4554 | #ifdef _WIN32 | ||
| 4555 | |||
| 4556 | if(use_dwm_flush) | ||
| 4557 | { | ||
| 4558 | do_DwmFlush(); | ||
| 4559 | } | ||
| 4560 | |||
| 4561 | #endif | ||
| 4562 | |||
| 4563 |
2/2✓ Branch 0 taken 219006 times.
✓ Branch 1 taken 19010727 times.
|
19229733 | if(sfxcleanup) |
| 4564 | 19010727 | sfx_cleanup(); | |
| 4565 | |||
| 4566 | 19229733 | frame_timings_poll(); | |
| 4567 | |||
| 4568 | #ifdef __EMSCRIPTEN__ | ||
| 4569 | // Yield the main thread back to the browser occasionally. | ||
| 4570 | if (is_headless()) | ||
| 4571 | { | ||
| 4572 | static int rate = 10000; | ||
| 4573 | static int force_yield = rate; | ||
| 4574 | if (force_yield++ >= rate) | ||
| 4575 | { | ||
| 4576 | force_yield = 0; | ||
| 4577 | emscripten_sleep(0); | ||
| 4578 | } | ||
| 4579 | } | ||
| 4580 | #endif | ||
| 4581 | |||
| 4582 |
3/4✓ Branch 0 taken 100 times.
✓ Branch 1 taken 19229633 times.
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
|
19229733 | if (zqtesting_mode && test_mode_auto_restart) |
| 4583 | { | ||
| 4584 | ✗ | static auto last_write_time = fs::last_write_time(qstpath); | |
| 4585 | ✗ | static auto last_check = std::chrono::system_clock::now(); | |
| 4586 | |||
| 4587 | ✗ | if (std::chrono::system_clock::now() - last_check > 200ms) | |
| 4588 | { | ||
| 4589 | ✗ | last_check = std::chrono::system_clock::now(); | |
| 4590 | ✗ | auto write_time = fs::last_write_time(qstpath); | |
| 4591 | ✗ | if (last_write_time != write_time) | |
| 4592 | { | ||
| 4593 | ✗ | last_write_time = write_time; | |
| 4594 | ✗ | disableClickToFreeze = false; | |
| 4595 | ✗ | Quit = qRESET; | |
| 4596 | ✗ | replay_quit(); | |
| 4597 | ✗ | } | |
| 4598 | ✗ | } | |
| 4599 | ✗ | } | |
| 4600 | 19231110 | } | |
| 4601 | |||
| 4602 | 590 | void zapout() | |
| 4603 | { | ||
| 4604 | 590 | set_clip_rect(scrollbuf_old, 0, 0, scrollbuf_old->w, scrollbuf_old->h); | |
| 4605 | 590 | blit(framebuf,scrollbuf_old,0,0,256,0,256,framebuf->h); | |
| 4606 | |||
| 4607 | 590 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4608 | 590 | script_drawing_commands.Clear(); | |
| 4609 | |||
| 4610 | // zap out | ||
| 4611 |
2/2✓ Branch 0 taken 590 times.
✓ Branch 1 taken 14160 times.
|
14750 | for(int32_t i=1; i<=24; i++) |
| 4612 | { | ||
| 4613 | 14160 | draw_fuzzy(i); | |
| 4614 | 14160 | advanceframe(true); | |
| 4615 | |||
| 4616 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14160 times.
|
14160 | if(Quit) |
| 4617 | { | ||
| 4618 | ✗ | break; | |
| 4619 | } | ||
| 4620 | 14160 | } | |
| 4621 | 590 | } | |
| 4622 | |||
| 4623 | 588 | void zapin() | |
| 4624 | { | ||
| 4625 | 588 | FFCore.warpScriptCheck(); | |
| 4626 | 588 | draw_screen(); | |
| 4627 | 588 | set_clip_rect(scrollbuf_old, 0, 0, scrollbuf_old->w, scrollbuf_old->h); | |
| 4628 | 588 | blit(framebuf,scrollbuf_old,0,0,256,0,256,framebuf->h); | |
| 4629 | |||
| 4630 | // zap out | ||
| 4631 | 588 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4632 |
2/2✓ Branch 0 taken 588 times.
✓ Branch 1 taken 14112 times.
|
14700 | for(int32_t i=24; i>=1; i--) |
| 4633 | { | ||
| 4634 | 14112 | draw_fuzzy(i); | |
| 4635 | 14112 | advanceframe(true); | |
| 4636 | |||
| 4637 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14112 times.
|
14112 | if(Quit) |
| 4638 | { | ||
| 4639 | ✗ | break; | |
| 4640 | } | ||
| 4641 | 14112 | } | |
| 4642 | 588 | } | |
| 4643 | |||
| 4644 | |||
| 4645 | 239 | void wavyout(bool showhero) | |
| 4646 | { | ||
| 4647 | 239 | draw_screen(showhero); | |
| 4648 | |||
| 4649 | 239 | BITMAP *wavebuf = create_bitmap_ex(8,288,framebuf->h); | |
| 4650 | 239 | clear_to_color(wavebuf,0); | |
| 4651 | 239 | blit(framebuf,wavebuf,0,0,16,0,framebuf->w,framebuf->h); | |
| 4652 | |||
| 4653 | static PALETTE wavepal; | ||
| 4654 | |||
| 4655 | int32_t ofs; | ||
| 4656 | 239 | int32_t amplitude=8; | |
| 4657 | |||
| 4658 | 239 | int32_t wavelength=4; | |
| 4659 | 239 | int height = viewport.visible_height(show_bottom_8px); | |
| 4660 | 239 | double palpos=0, palstep=4, palstop=126; | |
| 4661 | |||
| 4662 | 239 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4663 |
2/2✓ Branch 0 taken 238 times.
✓ Branch 1 taken 10021 times.
|
10259 | for(int32_t i=0; i<height; i+=wavelength) |
| 4664 | { | ||
| 4665 |
2/2✓ Branch 0 taken 2565376 times.
✓ Branch 1 taken 10021 times.
|
2575397 | for(int32_t l=0; l<256; l++) |
| 4666 | { | ||
| 4667 | 2565376 | wavepal[l].r=vbound(int32_t(RAMpal[l].r+((palpos/palstop)*(255-RAMpal[l].r))),0,255); | |
| 4668 | 2565376 | wavepal[l].g=vbound(int32_t(RAMpal[l].g+((palpos/palstop)*(255-RAMpal[l].g))),0,255); | |
| 4669 | 2565376 | wavepal[l].b=vbound(int32_t(RAMpal[l].b+((palpos/palstop)*(255-RAMpal[l].b))),0,255); | |
| 4670 | 2565376 | } | |
| 4671 | |||
| 4672 | 10021 | palpos+=palstep; | |
| 4673 | |||
| 4674 |
1/2✓ Branch 0 taken 10021 times.
✗ Branch 1 not taken.
|
10021 | if(palpos>=0) |
| 4675 | { | ||
| 4676 | 10021 | hw_palette = &wavepal; | |
| 4677 | 10021 | update_hw_pal = true; | |
| 4678 | 10021 | } | |
| 4679 | else | ||
| 4680 | { | ||
| 4681 | ✗ | hw_palette = &RAMpal; | |
| 4682 | ✗ | update_hw_pal = true; | |
| 4683 | } | ||
| 4684 | |||
| 4685 |
2/2✓ Branch 0 taken 1684936 times.
✓ Branch 1 taken 10021 times.
|
1694957 | for(int32_t j=0; j+playing_field_offset<framebuf->h; j++) |
| 4686 | { | ||
| 4687 |
2/2✓ Branch 0 taken 431343616 times.
✓ Branch 1 taken 1684936 times.
|
433028552 | for(int32_t k=0; k<256; k++) |
| 4688 | { | ||
| 4689 | 431343616 | ofs=0; | |
| 4690 | |||
| 4691 |
4/4✓ Branch 0 taken 210323456 times.
✓ Branch 1 taken 221020160 times.
✓ Branch 2 taken 105161728 times.
✓ Branch 3 taken 105161728 times.
|
431343616 | if((j<i)&&(j&1)) |
| 4692 | { | ||
| 4693 | 105161728 | ofs=int32_t(zc::math::Sin((double(i+j)*2*PI/height))*amplitude); | |
| 4694 | 105161728 | } | |
| 4695 | |||
| 4696 | 431343616 | framebuf->line[j+playing_field_offset][k]=wavebuf->line[j+playing_field_offset][k+ofs+16]; | |
| 4697 | 431343616 | } | |
| 4698 | 1684936 | } | |
| 4699 | |||
| 4700 | 10021 | advanceframe(true); | |
| 4701 | |||
| 4702 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10020 times.
|
10021 | if(Quit) |
| 4703 | 1 | break; | |
| 4704 | 10020 | } | |
| 4705 | |||
| 4706 | 239 | destroy_bitmap(wavebuf); | |
| 4707 | |||
| 4708 | 239 | hw_palette = &RAMpal; | |
| 4709 | 239 | update_hw_pal = true; | |
| 4710 | 239 | } | |
| 4711 | |||
| 4712 | 236 | void wavyin() | |
| 4713 | { | ||
| 4714 | 236 | draw_screen(); | |
| 4715 | |||
| 4716 | 236 | BITMAP *wavebuf = create_bitmap_ex(8,288,framebuf->h); | |
| 4717 | 236 | clear_to_color(wavebuf,0); | |
| 4718 | 236 | blit(framebuf,wavebuf,0,0,16,0,framebuf->w,framebuf->h); | |
| 4719 | |||
| 4720 | static PALETTE wavepal; | ||
| 4721 | |||
| 4722 | 236 | refreshpal=false; | |
| 4723 | int32_t ofs; | ||
| 4724 | 236 | int32_t amplitude=8; | |
| 4725 | 236 | int32_t wavelength=4; | |
| 4726 | 236 | int height = viewport.visible_height(show_bottom_8px); | |
| 4727 | 236 | double palpos=height, palstep=4, palstop=126; | |
| 4728 | |||
| 4729 | 236 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 4730 |
2/2✓ Branch 0 taken 235 times.
✓ Branch 1 taken 9879 times.
|
10114 | for(int32_t i=0; i<height; i+=wavelength) |
| 4731 | { | ||
| 4732 |
2/2✓ Branch 0 taken 2529024 times.
✓ Branch 1 taken 9879 times.
|
2538903 | for(int32_t l=0; l<256; l++) |
| 4733 | { | ||
| 4734 | 2529024 | wavepal[l].r=vbound(int32_t(RAMpal[l].r+((palpos/palstop)*(255-RAMpal[l].r))),0,255); | |
| 4735 | 2529024 | wavepal[l].g=vbound(int32_t(RAMpal[l].g+((palpos/palstop)*(255-RAMpal[l].g))),0,255); | |
| 4736 | 2529024 | wavepal[l].b=vbound(int32_t(RAMpal[l].b+((palpos/palstop)*(255-RAMpal[l].b))),0,255); | |
| 4737 | 2529024 | } | |
| 4738 | |||
| 4739 | 9879 | palpos-=palstep; | |
| 4740 | |||
| 4741 |
1/2✓ Branch 0 taken 9879 times.
✗ Branch 1 not taken.
|
9879 | if(palpos>=0) |
| 4742 | { | ||
| 4743 | 9879 | hw_palette = &wavepal; | |
| 4744 | 9879 | update_hw_pal = true; | |
| 4745 | 9879 | } | |
| 4746 | else | ||
| 4747 | { | ||
| 4748 | ✗ | hw_palette = &RAMpal; | |
| 4749 | ✗ | update_hw_pal = true; | |
| 4750 | } | ||
| 4751 | |||
| 4752 |
2/2✓ Branch 0 taken 1661080 times.
✓ Branch 1 taken 9879 times.
|
1670959 | for(int32_t j=0; j+playing_field_offset<framebuf->h; j++) |
| 4753 | { | ||
| 4754 |
2/2✓ Branch 0 taken 425236480 times.
✓ Branch 1 taken 1661080 times.
|
426897560 | for(int32_t k=0; k<256; k++) |
| 4755 | { | ||
| 4756 | 425236480 | ofs=0; | |
| 4757 | |||
| 4758 |
4/4✓ Branch 0 taken 215168256 times.
✓ Branch 1 taken 210068224 times.
✓ Branch 2 taken 108848640 times.
✓ Branch 3 taken 106319616 times.
|
425236480 | if((j<(height-1-i))&&(j&1)) |
| 4759 | { | ||
| 4760 | 106319616 | ofs=int32_t(zc::math::Sin((double(i+j)*2*PI/height))*amplitude); | |
| 4761 | 106319616 | } | |
| 4762 | |||
| 4763 | 425236480 | framebuf->line[j+playing_field_offset][k]=wavebuf->line[j+playing_field_offset][k+ofs+16]; | |
| 4764 | 425236480 | } | |
| 4765 | 1661080 | } | |
| 4766 | |||
| 4767 | 9879 | advanceframe(true); | |
| 4768 | |||
| 4769 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9878 times.
|
9879 | if(Quit) |
| 4770 | 1 | break; | |
| 4771 | 9878 | } | |
| 4772 | |||
| 4773 | 236 | destroy_bitmap(wavebuf); | |
| 4774 | |||
| 4775 | 236 | hw_palette = &RAMpal; | |
| 4776 | 236 | update_hw_pal = true; | |
| 4777 | 236 | } | |
| 4778 | |||
| 4779 | 4608 | void blackscr(int32_t fcnt,bool showsubscr) | |
| 4780 | { | ||
| 4781 | 4608 | reset_pal_cycling(); | |
| 4782 | 4608 | script_drawing_commands.Clear(); | |
| 4783 | |||
| 4784 | 4608 | FFCore.warpScriptCheck(); | |
| 4785 | 4608 | bool showtime = game->should_show_time(); | |
| 4786 |
2/2✓ Branch 0 taken 4601 times.
✓ Branch 1 taken 137797 times.
|
142398 | while(fcnt>0) |
| 4787 | { | ||
| 4788 | 137797 | clear_bitmap(framebuf); | |
| 4789 | |||
| 4790 |
2/2✓ Branch 0 taken 59340 times.
✓ Branch 1 taken 78457 times.
|
137797 | if(showsubscr) |
| 4791 | { | ||
| 4792 | 78457 | put_passive_subscr(framebuf,0,0,showtime,sspUP); | |
| 4793 |
4/4✓ Branch 0 taken 70627 times.
✓ Branch 1 taken 7830 times.
✓ Branch 2 taken 1410 times.
✓ Branch 3 taken 69217 times.
|
78457 | if(get_qr(qr_SCRIPTDRAWSINWARPS) || (get_qr(qr_PASSIVE_SUBSCRIPT_RUNS_WHEN_GAME_IS_FROZEN))) |
| 4794 | { | ||
| 4795 | 9240 | do_script_draws(framebuf, origin_scr, 0, playing_field_offset); | |
| 4796 | 9240 | } | |
| 4797 | 78457 | } | |
| 4798 | |||
| 4799 | 137797 | advanceframe(true); | |
| 4800 | |||
| 4801 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 137790 times.
|
137797 | if(Quit) |
| 4802 | 7 | break; | |
| 4803 | |||
| 4804 | 137790 | --fcnt; | |
| 4805 | } | ||
| 4806 | 4608 | } | |
| 4807 | |||
| 4808 | 2877 | void openscreen(int32_t shape) | |
| 4809 | { | ||
| 4810 | 2877 | update_viewport(); | |
| 4811 | 2877 | is_opening_screen = true; | |
| 4812 | 2877 | reset_pal_cycling(); | |
| 4813 | 2877 | black_opening_count=0; | |
| 4814 | |||
| 4815 |
3/4✓ Branch 0 taken 531 times.
✓ Branch 1 taken 2346 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 531 times.
|
2877 | if(COOLSCROLL || shape>-1) |
| 4816 | { | ||
| 4817 | 2346 | open_black_opening(HeroX()+8, (HeroY()-HeroZ()-HeroFakeZ())+8+playing_field_offset, true, shape); | |
| 4818 | 2346 | return; | |
| 4819 | } | ||
| 4820 | else | ||
| 4821 | { | ||
| 4822 | 531 | Hero.setDontDraw(true); | |
| 4823 | 531 | show_subscreen_dmap_dots=false; | |
| 4824 | 531 | show_subscreen_numbers=false; | |
| 4825 | 531 | show_subscreen_life=false; | |
| 4826 | } | ||
| 4827 | |||
| 4828 | 531 | int32_t x=128; | |
| 4829 | |||
| 4830 | 531 | FFCore.warpScriptCheck(); | |
| 4831 |
2/2✓ Branch 0 taken 531 times.
✓ Branch 1 taken 42480 times.
|
43011 | for(int32_t i=0; i<80; i++) |
| 4832 | { | ||
| 4833 | 42480 | draw_screen(); | |
| 4834 | 42480 | x=128-(((i*128/80)/8)*8); | |
| 4835 | |||
| 4836 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42480 times.
|
42480 | if(x>0) |
| 4837 | { | ||
| 4838 | 42480 | rectfill(framebuf,0,playing_field_offset,x,(viewport.h - 1)+playing_field_offset,0); | |
| 4839 | 42480 | rectfill(framebuf,viewport.w-x,playing_field_offset,255,(viewport.h - 1)+playing_field_offset,0); | |
| 4840 | 42480 | } | |
| 4841 | |||
| 4842 | 42480 | advanceframe(true); | |
| 4843 | |||
| 4844 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42480 times.
|
42480 | if(Quit) |
| 4845 | { | ||
| 4846 | ✗ | break; | |
| 4847 | } | ||
| 4848 | 42480 | } | |
| 4849 | |||
| 4850 | 531 | Hero.setDontDraw(false); | |
| 4851 | 531 | show_subscreen_items=true; | |
| 4852 | 531 | show_subscreen_dmap_dots=true; | |
| 4853 | 531 | show_subscreen_numbers=true; | |
| 4854 | 531 | show_subscreen_life=true; | |
| 4855 | 2877 | } | |
| 4856 | |||
| 4857 | 15 | void closescreen(int32_t shape) | |
| 4858 | { | ||
| 4859 | 15 | is_opening_screen = false; | |
| 4860 | 15 | reset_pal_cycling(); | |
| 4861 | 15 | black_opening_count=0; | |
| 4862 | |||
| 4863 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15 | if(COOLSCROLL || shape>-1) |
| 4864 | { | ||
| 4865 | 15 | close_black_opening(HeroX()+8, (HeroY()-HeroZ()-HeroFakeZ())+8+playing_field_offset, true, shape); | |
| 4866 | 15 | return; | |
| 4867 | } | ||
| 4868 | else | ||
| 4869 | { | ||
| 4870 | ✗ | Hero.setDontDraw(true); | |
| 4871 | ✗ | show_subscreen_dmap_dots=false; | |
| 4872 | ✗ | show_subscreen_numbers=false; | |
| 4873 | // show_subscreen_items=false; | ||
| 4874 | ✗ | show_subscreen_life=false; | |
| 4875 | } | ||
| 4876 | |||
| 4877 | ✗ | int32_t x=128; | |
| 4878 | |||
| 4879 | ✗ | FFCore.warpScriptCheck(); | |
| 4880 | ✗ | for(int32_t i=79; i>=0; --i) | |
| 4881 | { | ||
| 4882 | ✗ | draw_screen(); | |
| 4883 | ✗ | x=128-(((i*128/80)/8)*8); | |
| 4884 | |||
| 4885 | ✗ | if(x>0) | |
| 4886 | { | ||
| 4887 | ✗ | rectfill(framebuf,0,playing_field_offset,x,(viewport.h - 1)+playing_field_offset,0); | |
| 4888 | ✗ | rectfill(framebuf,viewport.w-x,playing_field_offset,255,(viewport.h - 1)+playing_field_offset,0); | |
| 4889 | ✗ | } | |
| 4890 | |||
| 4891 | ✗ | advanceframe(true); | |
| 4892 | |||
| 4893 | ✗ | if(Quit) | |
| 4894 | { | ||
| 4895 | ✗ | break; | |
| 4896 | } | ||
| 4897 | ✗ | } | |
| 4898 | |||
| 4899 | ✗ | Hero.setDontDraw(false); | |
| 4900 | ✗ | show_subscreen_items=true; | |
| 4901 | ✗ | show_subscreen_dmap_dots=true; | |
| 4902 | 15 | } | |
| 4903 | |||
| 4904 | 326 | int32_t TriforceCount() | |
| 4905 | { | ||
| 4906 | 326 | int32_t c=0; | |
| 4907 | |||
| 4908 |
2/2✓ Branch 0 taken 2608 times.
✓ Branch 1 taken 326 times.
|
2934 | for(int32_t i=1; i<=8; i++) |
| 4909 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 2112 times.
|
4720 | if(game->lvlitems[i]&(1 << li_mcguffin)) |
| 4910 | 2112 | ++c; | |
| 4911 | |||
| 4912 | 326 | return c; | |
| 4913 | } | ||
| 4914 | |||
| 4915 | ✗ | int32_t onCustomGame() | |
| 4916 | { | ||
| 4917 | ✗ | auto save = get_unset_save_slot(); | |
| 4918 | ✗ | if (!save) | |
| 4919 | ✗ | return D_CLOSE; | |
| 4920 | |||
| 4921 | ✗ | if (prompt_for_quest_path(save->header->qstpath)) | |
| 4922 | { | ||
| 4923 | ✗ | save->header->qstpath = qstpath; | |
| 4924 | ✗ | return D_O_K; | |
| 4925 | } | ||
| 4926 | |||
| 4927 | ✗ | return D_CLOSE; | |
| 4928 | ✗ | } | |
| 4929 | |||
| 4930 | ✗ | int32_t onContinue() | |
| 4931 | { | ||
| 4932 | ✗ | return D_CLOSE; | |
| 4933 | } | ||
| 4934 | |||
| 4935 | ✗ | int32_t onThrottleFPS() | |
| 4936 | { | ||
| 4937 | ✗ | Throttlefps = !Throttlefps; | |
| 4938 | ✗ | zc_set_config(cfg_sect,"throttlefps", (int32_t)Throttlefps); | |
| 4939 | ✗ | return D_O_K; | |
| 4940 | } | ||
| 4941 | |||
| 4942 | ✗ | int32_t onWinPosSave() | |
| 4943 | { | ||
| 4944 | ✗ | SaveWinPos = !SaveWinPos; | |
| 4945 | ✗ | zc_set_config(cfg_sect,"save_window_position",(int32_t)SaveWinPos); | |
| 4946 | ✗ | return D_O_K; | |
| 4947 | } | ||
| 4948 | ✗ | int32_t onIntegerScaling() | |
| 4949 | { | ||
| 4950 | ✗ | scaleForceInteger = !scaleForceInteger; | |
| 4951 | ✗ | zc_set_config("zeldadx","scaling_force_integer",(int)scaleForceInteger); | |
| 4952 | ✗ | return D_O_K; | |
| 4953 | } | ||
| 4954 | ✗ | int32_t onStretchGame() | |
| 4955 | { | ||
| 4956 | ✗ | stretchGame = !stretchGame; | |
| 4957 | ✗ | zc_set_config("zeldadx","stretch_game_area",stretchGame?1:0); | |
| 4958 | ✗ | return D_O_K; | |
| 4959 | } | ||
| 4960 | |||
| 4961 | ✗ | int32_t onClickToFreeze() | |
| 4962 | { | ||
| 4963 | ✗ | ClickToFreeze = !ClickToFreeze; | |
| 4964 | ✗ | zc_set_config(cfg_sect,"clicktofreeze", (int32_t)ClickToFreeze); | |
| 4965 | ✗ | return D_O_K; | |
| 4966 | } | ||
| 4967 | |||
| 4968 | ✗ | int32_t OnSaveZCConfig() | |
| 4969 | { | ||
| 4970 | ✗ | if(jwin_alert3( | |
| 4971 | "Save Configuration", | ||
| 4972 | "Are you sure that you wish to save your present configuration settings?", | ||
| 4973 | "This will overwrite your prior settings!", | ||
| 4974 | NULL, | ||
| 4975 | "&Yes", | ||
| 4976 | "&No", | ||
| 4977 | NULL, | ||
| 4978 | 'y', | ||
| 4979 | 'n', | ||
| 4980 | 0, | ||
| 4981 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 4982 | { | ||
| 4983 | ✗ | save_game_configs(); | |
| 4984 | ✗ | return D_O_K; | |
| 4985 | } | ||
| 4986 | ✗ | else return D_O_K; | |
| 4987 | ✗ | } | |
| 4988 | |||
| 4989 | ✗ | int32_t OnnClearQuestDir() | |
| 4990 | { | ||
| 4991 | ✗ | auto current_path = fs::current_path() / "quests"; | |
| 4992 | ✗ | if(jwin_alert3( | |
| 4993 | "Clear Current Directory Cache", | ||
| 4994 | "Are you sure that you wish to reset where ZC Player looks for quests?", | ||
| 4995 | ✗ | fmt::format("The new directory will be: {}", current_path.string()).c_str(), | |
| 4996 | NULL, | ||
| 4997 | "&Yes", | ||
| 4998 | "&No", | ||
| 4999 | NULL, | ||
| 5000 | 'y', | ||
| 5001 | 'n', | ||
| 5002 | 0, | ||
| 5003 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 5004 | { | ||
| 5005 | ✗ | zc_set_config("zeldadx","quest_dir","quests"); | |
| 5006 | ✗ | flush_config_file(); | |
| 5007 | ✗ | strcpy(qstdir,"quests"); | |
| 5008 | #ifdef __EMSCRIPTEN__ | ||
| 5009 | em_sync_fs(); | ||
| 5010 | #endif | ||
| 5011 | ✗ | return D_O_K; | |
| 5012 | } | ||
| 5013 | ✗ | else return D_O_K; | |
| 5014 | ✗ | } | |
| 5015 | |||
| 5016 | ✗ | int32_t onConsole() | |
| 5017 | { | ||
| 5018 | ✗ | if ( !console_enabled ) | |
| 5019 | { | ||
| 5020 | ✗ | AlertDialog("ZC Console", | |
| 5021 | ✗ | "Open the ZC Console?" | |
| 5022 | "\nThis will display any messages logged by scripts," | ||
| 5023 | " including errors.", | ||
| 5024 | ✗ | [&](bool ret,bool) | |
| 5025 | { | ||
| 5026 | ✗ | if(ret) | |
| 5027 | { | ||
| 5028 | ✗ | FFCore.ZScriptConsole(true); | |
| 5029 | ✗ | } | |
| 5030 | ✗ | }).show(); | |
| 5031 | ✗ | return D_O_K; | |
| 5032 | } | ||
| 5033 | else | ||
| 5034 | { | ||
| 5035 | ✗ | FFCore.ZScriptConsole(false); | |
| 5036 | ✗ | return D_O_K; | |
| 5037 | } | ||
| 5038 | ✗ | } | |
| 5039 | |||
| 5040 | ✗ | int32_t onClrConsoleOnReload() | |
| 5041 | { | ||
| 5042 | ✗ | clearConsoleOnReload = !clearConsoleOnReload; | |
| 5043 | ✗ | zc_set_config("CONSOLE","clear_console_on_reload",clearConsoleOnReload?1:0); | |
| 5044 | ✗ | return D_O_K; | |
| 5045 | } | ||
| 5046 | ✗ | int32_t onClrConsoleOnLoad() | |
| 5047 | { | ||
| 5048 | ✗ | clearConsoleOnLoad = !clearConsoleOnLoad; | |
| 5049 | ✗ | zc_set_config("CONSOLE","clear_console_on_load",clearConsoleOnLoad?1:0); | |
| 5050 | ✗ | return D_O_K; | |
| 5051 | } | ||
| 5052 | |||
| 5053 | |||
| 5054 | ✗ | int32_t onFrameSkip() | |
| 5055 | { | ||
| 5056 | ✗ | FrameSkip = !FrameSkip; | |
| 5057 | ✗ | return D_O_K; | |
| 5058 | } | ||
| 5059 | |||
| 5060 | ✗ | int32_t onSaveDragResize() | |
| 5061 | { | ||
| 5062 | ✗ | SaveDragResize = !SaveDragResize; | |
| 5063 | ✗ | zc_set_config(cfg_sect,"save_drag_resize",(int32_t)SaveDragResize); | |
| 5064 | ✗ | return D_O_K; | |
| 5065 | } | ||
| 5066 | |||
| 5067 | ✗ | int32_t onDragAspect() | |
| 5068 | { | ||
| 5069 | ✗ | DragAspect = !DragAspect; | |
| 5070 | ✗ | zc_set_config(cfg_sect,"drag_aspect",(int32_t)DragAspect); | |
| 5071 | ✗ | return D_O_K; | |
| 5072 | } | ||
| 5073 | |||
| 5074 | ✗ | int32_t onTransLayers() | |
| 5075 | { | ||
| 5076 | ✗ | TransLayers = !TransLayers; | |
| 5077 | ✗ | zc_set_config(cfg_sect,"translayers",(int32_t)TransLayers); | |
| 5078 | ✗ | return D_O_K; | |
| 5079 | } | ||
| 5080 | |||
| 5081 | ✗ | int32_t onNESquit() | |
| 5082 | { | ||
| 5083 | ✗ | NESquit = !NESquit; | |
| 5084 | ✗ | zc_set_config(cfg_sect,"fastquit",(int32_t)NESquit); | |
| 5085 | ✗ | return D_O_K; | |
| 5086 | } | ||
| 5087 | |||
| 5088 | ✗ | int32_t onVolKeys() | |
| 5089 | { | ||
| 5090 | ✗ | volkeys = !volkeys; | |
| 5091 | ✗ | zc_set_config(sfx_sect,"volkeys",(int32_t)volkeys); | |
| 5092 | ✗ | return D_O_K; | |
| 5093 | } | ||
| 5094 | |||
| 5095 | ✗ | int32_t onShowFPS() | |
| 5096 | { | ||
| 5097 | ✗ | ShowFPS = !ShowFPS; | |
| 5098 | ✗ | zc_set_config(cfg_sect,"showfps",(int32_t)ShowFPS); | |
| 5099 | ✗ | return D_O_K; | |
| 5100 | } | ||
| 5101 | |||
| 5102 | ✗ | int32_t onShowTime() | |
| 5103 | { | ||
| 5104 | ✗ | ShowGameTime = !ShowGameTime; | |
| 5105 | ✗ | zc_set_config(cfg_sect,"showtime",ShowGameTime); | |
| 5106 | ✗ | return D_O_K; | |
| 5107 | } | ||
| 5108 | |||
| 5109 | 2269104954 | bool is_Fkey(int32_t k) | |
| 5110 | { | ||
| 5111 |
2/2✓ Branch 0 taken 230756436 times.
✓ Branch 1 taken 2038348518 times.
|
2269104954 | switch(k) |
| 5112 | { | ||
| 5113 | case KEY_F1: | ||
| 5114 | case KEY_F2: | ||
| 5115 | case KEY_F3: | ||
| 5116 | case KEY_F4: | ||
| 5117 | case KEY_F5: | ||
| 5118 | case KEY_F6: | ||
| 5119 | case KEY_F7: | ||
| 5120 | case KEY_F8: | ||
| 5121 | case KEY_F9: | ||
| 5122 | case KEY_F10: | ||
| 5123 | case KEY_F11: | ||
| 5124 | case KEY_F12: | ||
| 5125 | 230756436 | return true; | |
| 5126 | } | ||
| 5127 | |||
| 5128 | 2038348518 | return false; | |
| 5129 | 2269104954 | } | |
| 5130 | |||
| 5131 | void kb_getkey(DIALOG *d); | ||
| 5132 | |||
| 5133 | //Used by all keyboard key settings dialogues. | ||
| 5134 | ✗ | void kb_clearjoystick(DIALOG *d) | |
| 5135 | { | ||
| 5136 | ✗ | d->flags|=D_SELECTED; | |
| 5137 | |||
| 5138 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5139 | ✗ | jwin_draw_win(screen, (screen->w-160)/2, (screen->h-48)/2, 160, 48, FR_WIN); | |
| 5140 | // text_mode(vc(11)); | ||
| 5141 | ✗ | textout_centre_ex(screen, font, "Press any key to clear", gui_bmp->w/2, gui_bmp->h/2 - 8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5142 | ✗ | textout_centre_ex(screen, font, "ESC to cancel", gui_bmp->w/2, gui_bmp->h/2, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5143 | |||
| 5144 | ✗ | update_hw_screen(); | |
| 5145 | |||
| 5146 | ✗ | clear_keybuf(); | |
| 5147 | ✗ | int32_t k = next_press_key(); | |
| 5148 | ✗ | clear_keybuf(); | |
| 5149 | |||
| 5150 | //shnarf | ||
| 5151 | //47=f1 | ||
| 5152 | //59=esc | ||
| 5153 | // if(k>0 && k<123 && !((k>46)&&(k<60))) | ||
| 5154 | // *((int32_t*)d->dp3) = k; | ||
| 5155 | ✗ | if ( k != 59 ) *((int32_t*)d->dp3) = 0; | |
| 5156 | |||
| 5157 | |||
| 5158 | ✗ | d->flags&=~D_SELECTED; | |
| 5159 | ✗ | } | |
| 5160 | |||
| 5161 | //Clears key to 0. | ||
| 5162 | //Used by all keyboard key settings dialogues. | ||
| 5163 | void kb_clearkey(DIALOG *d); | ||
| 5164 | |||
| 5165 | ✗ | int32_t d_j_clearbutton_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5166 | { | ||
| 5167 | ✗ | switch(msg) | |
| 5168 | { | ||
| 5169 | case MSG_KEY: | ||
| 5170 | case MSG_CLICK: | ||
| 5171 | |||
| 5172 | ✗ | kb_clearjoystick(d); | |
| 5173 | |||
| 5174 | ✗ | while(gui_mouse_b()) | |
| 5175 | { | ||
| 5176 | ✗ | clear_keybuf(); | |
| 5177 | ✗ | rest(1); | |
| 5178 | } | ||
| 5179 | |||
| 5180 | ✗ | return D_REDRAW; | |
| 5181 | } | ||
| 5182 | |||
| 5183 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5184 | ✗ | } | |
| 5185 | |||
| 5186 | int32_t d_kbutton_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 5187 | //Only used in keyboard settings dialogues to clear keys. | ||
| 5188 | int32_t d_k_clearbutton_proc(int32_t msg,DIALOG *d,int32_t c); | ||
| 5189 | |||
| 5190 | ✗ | int32_t j_getbtn(DIALOG *d) | |
| 5191 | { | ||
| 5192 | ✗ | d->flags|=D_SELECTED; | |
| 5193 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5194 | ✗ | jwin_draw_win(screen, (screen->w-160)/2, (screen->h-48)/2, 160, 48, FR_WIN); | |
| 5195 | // text_mode(vc(11)); | ||
| 5196 | ✗ | int32_t y = screen->h/2 - 12; | |
| 5197 | ✗ | textout_centre_ex(screen, font, "Press a button", screen->w/2, y, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5198 | ✗ | textout_centre_ex(screen, font, "ESC to cancel", screen->w/2, y+8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5199 | ✗ | textout_centre_ex(screen, font, "SPACE to disable", screen->w/2, y+16, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5200 | |||
| 5201 | ✗ | update_hw_screen(); | |
| 5202 | |||
| 5203 | ✗ | int32_t b = next_joy_input(true); | |
| 5204 | ✗ | if (b == -2) | |
| 5205 | ✗ | return D_CLOSE; | |
| 5206 | |||
| 5207 | ✗ | if(b>=0) | |
| 5208 | ✗ | *((int32_t*)d->dp3) = b; | |
| 5209 | |||
| 5210 | ✗ | d->flags&=~D_SELECTED; | |
| 5211 | |||
| 5212 | ✗ | return D_O_K; | |
| 5213 | ✗ | } | |
| 5214 | |||
| 5215 | ✗ | void j_getstick(DIALOG *d) | |
| 5216 | { | ||
| 5217 | ✗ | d->flags|=D_SELECTED; | |
| 5218 | ✗ | jwin_button_proc(MSG_DRAW,d,0); | |
| 5219 | ✗ | jwin_draw_win(screen, (screen->w-160)/2, (screen->h-48)/2, 160, 48, FR_WIN); | |
| 5220 | // text_mode(vc(11)); | ||
| 5221 | ✗ | int32_t y = screen->h/2 - 12; | |
| 5222 | ✗ | textout_centre_ex(screen, font, "Move a stick (or DPAD)", screen->w/2, y, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5223 | ✗ | textout_centre_ex(screen, font, "ESC to cancel", screen->w/2, y+8, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5224 | ✗ | textout_centre_ex(screen, font, "SPACE to disable", screen->w/2, y+16, jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5225 | |||
| 5226 | ✗ | update_hw_screen(); | |
| 5227 | |||
| 5228 | ✗ | int32_t b = next_joy_input(false); | |
| 5229 | |||
| 5230 | ✗ | if(b>=0) | |
| 5231 | ✗ | *((int32_t*)d->dp3) = b; | |
| 5232 | |||
| 5233 | ✗ | d->flags&=~D_SELECTED; | |
| 5234 | ✗ | } | |
| 5235 | |||
| 5236 | ✗ | int32_t d_jbutton_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5237 | { | ||
| 5238 | ✗ | switch(msg) | |
| 5239 | { | ||
| 5240 | case MSG_KEY: | ||
| 5241 | case MSG_CLICK: | ||
| 5242 | |||
| 5243 | ✗ | int ret = j_getbtn(d); | |
| 5244 | ✗ | if (ret != D_O_K) | |
| 5245 | ✗ | return ret; | |
| 5246 | |||
| 5247 | ✗ | while(gui_mouse_b()) { | |
| 5248 | ✗ | rest(1); | |
| 5249 | ✗ | clear_keybuf(); | |
| 5250 | } | ||
| 5251 | |||
| 5252 | ✗ | return D_REDRAW; | |
| 5253 | } | ||
| 5254 | |||
| 5255 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5256 | ✗ | } | |
| 5257 | |||
| 5258 | ✗ | int32_t d_jstick_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5259 | { | ||
| 5260 | ✗ | switch(msg) | |
| 5261 | { | ||
| 5262 | case MSG_KEY: | ||
| 5263 | case MSG_CLICK: | ||
| 5264 | |||
| 5265 | ✗ | j_getstick(d); | |
| 5266 | |||
| 5267 | ✗ | while(gui_mouse_b()) { | |
| 5268 | ✗ | rest(1); | |
| 5269 | ✗ | clear_keybuf(); | |
| 5270 | } | ||
| 5271 | |||
| 5272 | ✗ | return D_REDRAW; | |
| 5273 | } | ||
| 5274 | |||
| 5275 | ✗ | return jwin_button_proc(msg,d,c); | |
| 5276 | ✗ | } | |
| 5277 | |||
| 5278 | //shnarf | ||
| 5279 | extern const char *key_str[]; | ||
| 5280 | std::string get_keystr(int key); | ||
| 5281 | |||
| 5282 | const char *pan_str[4] = { " MONO", " 1/2", " 3/4", " FULL" }; | ||
| 5283 | |||
| 5284 | static char str_a[80],str_b[80],str_s[80],str_m[80],str_l[80],str_r[80],str_p[80],str_ex1[80],str_ex2[80],str_ex3[80],str_ex4[80], | ||
| 5285 | str_leftmod1[80],str_leftmod2[80],str_rightmod1[80],str_rightmod2[80], str_left[80], str_right[80], str_up[80], str_down[80], | ||
| 5286 | str_primary_stick[80], str_secondary_stick[80]; | ||
| 5287 | |||
| 5288 | ✗ | int32_t d_stringloader(int32_t msg,DIALOG *d,int32_t c) | |
| 5289 | { | ||
| 5290 | //these are here to bypass compiler warnings about unused arguments | ||
| 5291 | ✗ | c=c; | |
| 5292 | |||
| 5293 | ✗ | if (d->w == 1) | |
| 5294 | { | ||
| 5295 | ✗ | if (!gamepad_dlg_cur_joystick || !al_get_joystick_active(gamepad_dlg_cur_joystick)) | |
| 5296 | { | ||
| 5297 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 5298 | ✗ | return D_CLOSE; | |
| 5299 | } | ||
| 5300 | ✗ | } | |
| 5301 | |||
| 5302 | ✗ | if(msg==MSG_DRAW) | |
| 5303 | { | ||
| 5304 | ✗ | switch(d->w) | |
| 5305 | { | ||
| 5306 | case 0: | ||
| 5307 | ✗ | sprintf(str_a,"%03d\n%s",Akey,key_str[Akey]); | |
| 5308 | ✗ | sprintf(str_b,"%03d\n%s",Bkey,key_str[Bkey]); | |
| 5309 | ✗ | sprintf(str_s,"%03d\n%s",Skey,key_str[Skey]); | |
| 5310 | ✗ | sprintf(str_l,"%03d\n%s",Lkey,key_str[Lkey]); | |
| 5311 | ✗ | sprintf(str_r,"%03d\n%s",Rkey,key_str[Rkey]); | |
| 5312 | ✗ | sprintf(str_p,"%03d\n%s",Pkey,key_str[Pkey]); | |
| 5313 | ✗ | sprintf(str_ex1,"%03d\n%s",Exkey1,key_str[Exkey1]); | |
| 5314 | ✗ | sprintf(str_ex2,"%03d\n%s",Exkey2,key_str[Exkey2]); | |
| 5315 | ✗ | sprintf(str_ex3,"%03d\n%s",Exkey3,key_str[Exkey3]); | |
| 5316 | ✗ | sprintf(str_ex4,"%03d\n%s",Exkey4,key_str[Exkey4]); | |
| 5317 | ✗ | sprintf(str_up,"%03d\n%s",DUkey,key_str[DUkey]); | |
| 5318 | ✗ | sprintf(str_down,"%03d\n%s",DDkey,key_str[DDkey]); | |
| 5319 | ✗ | sprintf(str_left,"%03d\n%s",DLkey,key_str[DLkey]); | |
| 5320 | ✗ | sprintf(str_right,"%03d\n%s",DRkey,key_str[DRkey]); | |
| 5321 | ✗ | sprintf(str_leftmod1,"%03d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5322 | ✗ | sprintf(str_leftmod2,"%03d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5323 | ✗ | sprintf(str_rightmod1,"%03d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5324 | ✗ | sprintf(str_rightmod2,"%03d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5325 | ✗ | break; | |
| 5326 | |||
| 5327 | case 1: | ||
| 5328 | ✗ | sprintf(str_a,"%03d\n%s",Abtn,joybtn_name(Abtn)); | |
| 5329 | ✗ | sprintf(str_b,"%03d\n%s",Bbtn,joybtn_name(Bbtn)); | |
| 5330 | ✗ | sprintf(str_s,"%03d\n%s",Sbtn,joybtn_name(Sbtn)); | |
| 5331 | ✗ | sprintf(str_l,"%03d\n%s",Lbtn,joybtn_name(Lbtn)); | |
| 5332 | ✗ | sprintf(str_r,"%03d\n%s",Rbtn,joybtn_name(Rbtn)); | |
| 5333 | ✗ | sprintf(str_m,"%03d\n%s",Mbtn,joybtn_name(Mbtn)); | |
| 5334 | ✗ | sprintf(str_p,"%03d\n%s",Pbtn,joybtn_name(Pbtn)); | |
| 5335 | ✗ | sprintf(str_ex1,"%03d\n%s",Exbtn1,joybtn_name(Exbtn1)); | |
| 5336 | ✗ | sprintf(str_ex2,"%03d\n%s",Exbtn2,joybtn_name(Exbtn2)); | |
| 5337 | ✗ | sprintf(str_ex3,"%03d\n%s",Exbtn3,joybtn_name(Exbtn3)); | |
| 5338 | ✗ | sprintf(str_ex4,"%03d\n%s",Exbtn4,joybtn_name(Exbtn4)); | |
| 5339 | ✗ | sprintf(str_up,"%03d\n%s",DUbtn,joybtn_name(DUbtn)); | |
| 5340 | ✗ | sprintf(str_down,"%03d\n%s",DDbtn,joybtn_name(DDbtn)); | |
| 5341 | ✗ | sprintf(str_left,"%03d\n%s",DLbtn,joybtn_name(DLbtn)); | |
| 5342 | ✗ | sprintf(str_right,"%03d\n%s",DRbtn,joybtn_name(DRbtn)); | |
| 5343 | ✗ | sprintf(str_primary_stick,"%03d\n%s",js_stick_1_x_stick,joystick_name(js_stick_1_x_stick)); | |
| 5344 | ✗ | sprintf(str_secondary_stick,"%03d\n%s",js_stick_2_x_stick,joystick_name(js_stick_2_x_stick)); | |
| 5345 | ✗ | sprintf(str_leftmod1,"%03d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5346 | ✗ | sprintf(str_leftmod2,"%03d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5347 | ✗ | sprintf(str_rightmod1,"%03d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5348 | ✗ | sprintf(str_rightmod2,"%03d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5349 | ✗ | break; | |
| 5350 | |||
| 5351 | case 2: | ||
| 5352 | ✗ | sprintf(str_a," %3d",midi_volume); | |
| 5353 | ✗ | sprintf(str_l," %3d",emusic_volume); | |
| 5354 | ✗ | sprintf(str_r," %3d",sfx_volume); | |
| 5355 | ✗ | strcpy(str_s,pan_str[pan_style]); | |
| 5356 | ✗ | sprintf(str_leftmod1,"%3d\n%s",cheat_modifier_keys[0],key_str[cheat_modifier_keys[0]]); | |
| 5357 | ✗ | sprintf(str_leftmod2,"%3d\n%s",cheat_modifier_keys[1],key_str[cheat_modifier_keys[1]]); | |
| 5358 | ✗ | sprintf(str_rightmod1,"%3d\n%s",cheat_modifier_keys[2],key_str[cheat_modifier_keys[2]]); | |
| 5359 | ✗ | sprintf(str_rightmod2,"%3d\n%s",cheat_modifier_keys[3],key_str[cheat_modifier_keys[3]]); | |
| 5360 | ✗ | break; | |
| 5361 | } | ||
| 5362 | ✗ | } | |
| 5363 | |||
| 5364 | ✗ | return D_O_K; | |
| 5365 | ✗ | } | |
| 5366 | |||
| 5367 | ✗ | int32_t set_vol(void *dp3, int32_t d2) | |
| 5368 | { | ||
| 5369 | ✗ | switch(((int32_t*)dp3)[0]) | |
| 5370 | { | ||
| 5371 | case 0: | ||
| 5372 | ✗ | midi_volume = zc_min(d2<<3,255); | |
| 5373 | ✗ | break; | |
| 5374 | |||
| 5375 | case 1: | ||
| 5376 | ✗ | digi_volume = zc_min(d2<<3,255); | |
| 5377 | ✗ | break; | |
| 5378 | |||
| 5379 | case 2: | ||
| 5380 | ✗ | emusic_volume = zc_min(d2<<3,255); | |
| 5381 | ✗ | break; | |
| 5382 | |||
| 5383 | case 3: | ||
| 5384 | ✗ | sfx_volume = zc_min(d2<<3,255); | |
| 5385 | ✗ | break; | |
| 5386 | } | ||
| 5387 | |||
| 5388 | // text_mode(vc(11)); | ||
| 5389 | ✗ | textprintf_right_ex(screen,get_zc_font(font_lfont_l), ((int32_t*)dp3)[1],((int32_t*)dp3)[2],jwin_pal[jcBOXFG],jwin_pal[jcBOX]," %3d",zc_min(d2<<3,255)); | |
| 5390 | ✗ | return D_O_K; | |
| 5391 | } | ||
| 5392 | |||
| 5393 | ✗ | int32_t set_pan(void *dp3, int32_t d2) | |
| 5394 | { | ||
| 5395 | ✗ | pan_style = vbound(d2,0,3); | |
| 5396 | // text_mode(vc(11)); | ||
| 5397 | ✗ | textout_right_ex(screen,get_zc_font(font_lfont_l), pan_str[pan_style],((int32_t*)dp3)[1],((int32_t*)dp3)[2],jwin_pal[jcBOXFG],jwin_pal[jcBOX]); | |
| 5398 | ✗ | return D_O_K; | |
| 5399 | } | ||
| 5400 | |||
| 5401 | static int32_t gamepad_joys_list[] = | ||
| 5402 | { | ||
| 5403 | 61, | ||
| 5404 | -1 | ||
| 5405 | }; | ||
| 5406 | |||
| 5407 | static int32_t gamepad_btn_list[] = | ||
| 5408 | { | ||
| 5409 | 6, | ||
| 5410 | 7,8,9,10,11,12,13,14,15,16,17, | ||
| 5411 | 18,19,20,21,22,23,24,25,26,27,28, | ||
| 5412 | 29,30,31,32,33,34,35,36,37,38,39, | ||
| 5413 | -1 | ||
| 5414 | }; | ||
| 5415 | |||
| 5416 | static int32_t gamepad_dirs_list[] = | ||
| 5417 | { | ||
| 5418 | 40,41,42,43, | ||
| 5419 | 44,45,46,47, | ||
| 5420 | 48,49,50,51, | ||
| 5421 | 52,53,54,55, | ||
| 5422 | 56,57,58,59, | ||
| 5423 | 60, | ||
| 5424 | -1 | ||
| 5425 | }; | ||
| 5426 | |||
| 5427 | static TABPANEL gamepad_tabs[] = | ||
| 5428 | { | ||
| 5429 | // (text) | ||
| 5430 | { (char *)"Controllers", D_SELECTED, gamepad_joys_list, 0, NULL }, | ||
| 5431 | { (char *)"Buttons", 0, gamepad_btn_list, 0, NULL }, | ||
| 5432 | { (char *)"Directions", 0, gamepad_dirs_list, 0, NULL }, | ||
| 5433 | { NULL, 0, NULL, 0, NULL } | ||
| 5434 | }; | ||
| 5435 | |||
| 5436 | ✗ | const char *joy_list(int32_t index, int32_t *list_size) | |
| 5437 | { | ||
| 5438 | ✗ | if (index == -1) | |
| 5439 | { | ||
| 5440 | ✗ | *list_size = al_get_num_joysticks(); | |
| 5441 | ✗ | return NULL; | |
| 5442 | } | ||
| 5443 | |||
| 5444 | ✗ | ALLEGRO_JOYSTICK* joy = al_get_joystick(index); | |
| 5445 | ✗ | if (!joy) | |
| 5446 | { | ||
| 5447 | ✗ | return "?"; | |
| 5448 | } | ||
| 5449 | |||
| 5450 | ✗ | return al_get_joystick_name(joy); | |
| 5451 | ✗ | } | |
| 5452 | |||
| 5453 | 427 | static ListData joy__list(joy_list, &font); | |
| 5454 | |||
| 5455 | ✗ | static int32_t d_joylist_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 5456 | { | ||
| 5457 | ✗ | int32_t d2 = d->d2; | |
| 5458 | ✗ | int32_t ret = jwin_droplist_proc(msg,d,c); | |
| 5459 | |||
| 5460 | ✗ | if(d2!=d->d2) | |
| 5461 | { | ||
| 5462 | ✗ | joystick_index = d->d2; | |
| 5463 | ✗ | ret |= D_REDRAW_ALL; | |
| 5464 | ✗ | } | |
| 5465 | |||
| 5466 | ✗ | return ret; | |
| 5467 | } | ||
| 5468 | |||
| 5469 | static DIALOG gamepad_dlg[] = | ||
| 5470 | { | ||
| 5471 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5472 | { jwin_win_proc, 8, 24, 304, 256, 0, 0, 0, D_EXIT, 0, 0, (void *) "Gamepad Controls", NULL, NULL }, | ||
| 5473 | { jwin_tab_proc, 8+4, 24+23,304-8,256-52,vc(0), vc(15), 0, 0, 0, 0, (void *) gamepad_tabs, NULL, (void *)gamepad_dlg }, | ||
| 5474 | { d_stringloader, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5475 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5476 | { jwin_button_proc, 90, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5477 | { jwin_button_proc, 170, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5478 | // 6 | ||
| 5479 | { d_dummy_proc, 14, 61, 294, 192, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5480 | // 7 | ||
| 5481 | { jwin_ctext_proc, 92, 92-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5482 | { jwin_ctext_proc, 92, 120-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_b, NULL, NULL }, | ||
| 5483 | { jwin_ctext_proc, 92, 148-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5484 | { jwin_ctext_proc, 92, 180-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex1, NULL, NULL }, | ||
| 5485 | { jwin_ctext_proc, 92, 212-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex3, NULL, NULL }, | ||
| 5486 | { jwin_ctext_proc, 237, 92-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_l, NULL, NULL }, | ||
| 5487 | { jwin_ctext_proc, 237, 120-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_r, NULL, NULL }, | ||
| 5488 | { jwin_ctext_proc, 237, 148-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_p, NULL, NULL }, | ||
| 5489 | { jwin_ctext_proc, 237, 180-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex2, NULL, NULL }, | ||
| 5490 | { jwin_ctext_proc, 237, 212-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex4, NULL, NULL }, | ||
| 5491 | { jwin_ctext_proc, 92, 244-20, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_m, NULL, NULL }, | ||
| 5492 | // 18 | ||
| 5493 | { d_jbutton_proc, 22, 90-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "A", NULL, &Abtn}, | ||
| 5494 | { d_jbutton_proc, 22, 118-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "B", NULL, &Bbtn}, | ||
| 5495 | { d_jbutton_proc, 22, 146-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Start", NULL, &Sbtn}, | ||
| 5496 | { d_jbutton_proc, 22, 178-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "X (EX1)", NULL, &Exbtn1}, | ||
| 5497 | { d_jbutton_proc, 22, 210-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX3", NULL, &Exbtn3}, | ||
| 5498 | { d_jbutton_proc, 167, 90-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "L", NULL, &Lbtn}, | ||
| 5499 | { d_jbutton_proc, 167, 118-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "R", NULL, &Rbtn}, | ||
| 5500 | { d_jbutton_proc, 167, 146-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Map", NULL, &Pbtn}, | ||
| 5501 | { d_jbutton_proc, 167, 178-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Y (EX2)", NULL, &Exbtn2}, | ||
| 5502 | { d_jbutton_proc, 167, 210-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX4", NULL, &Exbtn4}, | ||
| 5503 | { d_jbutton_proc, 22, 242-20, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Menu", NULL, &Mbtn}, | ||
| 5504 | // 29 | ||
| 5505 | { d_j_clearbutton_proc, 22+91, 90-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Abtn}, | ||
| 5506 | { d_j_clearbutton_proc, 22+91, 118-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Bbtn}, | ||
| 5507 | { d_j_clearbutton_proc, 22+91, 146-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Sbtn}, | ||
| 5508 | { d_j_clearbutton_proc, 22+91, 178-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn1}, | ||
| 5509 | { d_j_clearbutton_proc, 22+91, 210-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn3}, | ||
| 5510 | { d_j_clearbutton_proc, 167+91, 90-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Lbtn}, | ||
| 5511 | { d_j_clearbutton_proc, 167+91, 118-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Rbtn}, | ||
| 5512 | { d_j_clearbutton_proc, 167+91, 146-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Pbtn}, | ||
| 5513 | { d_j_clearbutton_proc, 167+91, 178-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn2}, | ||
| 5514 | { d_j_clearbutton_proc, 167+91, 210-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exbtn4}, | ||
| 5515 | { d_j_clearbutton_proc, 22+91, 242-20, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Mbtn}, | ||
| 5516 | // 40 | ||
| 5517 | { jwin_frame_proc, 14, 62, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5518 | { jwin_frame_proc, 159, 62, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5519 | { jwin_text_proc, 30, 68, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Vertical", NULL, NULL }, | ||
| 5520 | { jwin_text_proc, 175, 68, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Horizontal", NULL, NULL }, | ||
| 5521 | // 44 | ||
| 5522 | { jwin_text_proc, 92, 84, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_up, NULL, NULL }, | ||
| 5523 | { jwin_text_proc, 92, 112, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_down, NULL, NULL }, | ||
| 5524 | { jwin_text_proc, 237, 84, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_left, NULL, NULL }, | ||
| 5525 | { jwin_text_proc, 237, 112, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_right, NULL, NULL }, | ||
| 5526 | // 48 | ||
| 5527 | { d_jbutton_proc, 22, 82, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Up", NULL, &DUbtn }, | ||
| 5528 | { d_jbutton_proc, 22, 110, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Down", NULL, &DDbtn }, | ||
| 5529 | { d_jbutton_proc, 167, 82, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Left", NULL, &DLbtn }, | ||
| 5530 | { d_jbutton_proc, 167, 110, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Right", NULL, &DRbtn }, | ||
| 5531 | // 52 | ||
| 5532 | { d_j_clearbutton_proc, 22+91, 82, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DUbtn}, | ||
| 5533 | { d_j_clearbutton_proc, 22+91, 110, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DDbtn}, | ||
| 5534 | { d_j_clearbutton_proc, 167+91, 82, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DLbtn}, | ||
| 5535 | { d_j_clearbutton_proc, 167+91, 110, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DRbtn}, | ||
| 5536 | // 56 | ||
| 5537 | { jwin_check_proc, 22, 150, 147, 8, vc(14), vc(1), 0, 0, 1, 0, (void *) "Primary: Use Analog Stick (Ignore above and use below instead)", NULL, NULL }, | ||
| 5538 | { d_jstick_proc, 22, 165, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Primary", NULL, &js_stick_1_x_stick }, | ||
| 5539 | { d_jstick_proc, 22, 195, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Secondary", NULL, &js_stick_2_x_stick }, | ||
| 5540 | { jwin_text_proc, 90, 165, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_primary_stick, NULL, NULL }, | ||
| 5541 | { jwin_text_proc, 90, 195, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_secondary_stick, NULL, NULL }, | ||
| 5542 | |||
| 5543 | // 61 | ||
| 5544 | { d_joylist_proc, 22, 62, 150, 16, 0, 0, 0, 0, 0, 0, (void *) &joy__list, NULL, NULL }, | ||
| 5545 | |||
| 5546 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5547 | }; | ||
| 5548 | |||
| 5549 | static int32_t keyboard_keys_list[] = | ||
| 5550 | { | ||
| 5551 | 6,7,8,9,10, | ||
| 5552 | 11,12,13,14,15,16,17,18,19,20, | ||
| 5553 | 21,22,23,24,25,26,27,28,29,30, | ||
| 5554 | 31,32,33,34,35,36,37,38,39,40, | ||
| 5555 | -1 | ||
| 5556 | }; | ||
| 5557 | |||
| 5558 | static int32_t keyboard_dirs_list[] = | ||
| 5559 | { | ||
| 5560 | 41,42,43,44, | ||
| 5561 | 45,46,47,48, | ||
| 5562 | 49,50,51,52, | ||
| 5563 | 53,54,55,56, | ||
| 5564 | -1 | ||
| 5565 | }; | ||
| 5566 | |||
| 5567 | static int32_t keyboard_mods_list[] = | ||
| 5568 | { | ||
| 5569 | 57,58,59,60, | ||
| 5570 | 61,62,63,64, | ||
| 5571 | 65,66,67,68, | ||
| 5572 | 69,70,71,72, | ||
| 5573 | -1 | ||
| 5574 | }; | ||
| 5575 | |||
| 5576 | static TABPANEL keyboard_control_tabs[] = | ||
| 5577 | { | ||
| 5578 | // (text) | ||
| 5579 | { (char *)"Keys", D_SELECTED, keyboard_keys_list, 0, NULL }, | ||
| 5580 | { (char *)"Directions", 0, keyboard_dirs_list, 0, NULL }, | ||
| 5581 | { (char *)"Cheat Mods", 0, keyboard_mods_list, 0, NULL }, | ||
| 5582 | { NULL, 0, NULL, 0, NULL } | ||
| 5583 | }; | ||
| 5584 | |||
| 5585 | static DIALOG keyboard_control_dlg[] = | ||
| 5586 | { | ||
| 5587 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5588 | { jwin_win_proc, 8, 39, 304, 240, 0, 0, 0, D_EXIT, 0, 0, (void *) "Keyboard Controls", NULL, NULL }, | ||
| 5589 | { jwin_tab_proc, 8+4, 39+23,304-8,240-56,vc(0), vc(15), 0, 0, 0, 0, (void *) keyboard_control_tabs, NULL, (void *)keyboard_control_dlg }, | ||
| 5590 | { d_stringloader, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5591 | { jwin_button_proc, 90, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5592 | { jwin_button_proc, 170, 254, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5593 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5594 | // Keys | ||
| 5595 | // 6 | ||
| 5596 | { jwin_frame_proc, 14, 80, 148, 105, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5597 | { jwin_frame_proc, 158, 80, 148, 105, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5598 | { jwin_frame_proc, 14, 181, 292, 67, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5599 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Standard", NULL, NULL }, | ||
| 5600 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Extended", NULL, NULL }, | ||
| 5601 | // 11 | ||
| 5602 | { jwin_text_proc, 92-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5603 | { jwin_text_proc, 92-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_b, NULL, NULL }, | ||
| 5604 | { jwin_text_proc, 92-4, 158, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5605 | { jwin_text_proc, 92-4, 190, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex1, NULL, NULL }, | ||
| 5606 | { jwin_text_proc, 92-4, 222, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex3, NULL, NULL }, | ||
| 5607 | { jwin_text_proc, 237-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_l, NULL, NULL }, | ||
| 5608 | { jwin_text_proc, 237-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_r, NULL, NULL }, | ||
| 5609 | { jwin_text_proc, 237-4, 158, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_p, NULL, NULL }, | ||
| 5610 | { jwin_text_proc, 237-4, 190, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex2, NULL, NULL }, | ||
| 5611 | { jwin_text_proc, 237-4, 222, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_ex4, NULL, NULL }, | ||
| 5612 | // 21 | ||
| 5613 | { d_kbutton_proc, 22, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "A", NULL, &Akey}, | ||
| 5614 | { d_kbutton_proc, 22, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "B", NULL, &Bkey}, | ||
| 5615 | { d_kbutton_proc, 22, 156, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Start", NULL, &Skey}, | ||
| 5616 | { d_kbutton_proc, 22, 188, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "X (EX1)", NULL, &Exkey1}, | ||
| 5617 | { d_kbutton_proc, 22, 220, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX3", NULL, &Exkey3}, | ||
| 5618 | { d_kbutton_proc, 167, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "L", NULL, &Lkey}, | ||
| 5619 | { d_kbutton_proc, 167, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "R", NULL, &Rkey}, | ||
| 5620 | { d_kbutton_proc, 167, 156, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Map", NULL, &Pkey}, | ||
| 5621 | { d_kbutton_proc, 167, 188, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Y (EX2)", NULL, &Exkey2}, | ||
| 5622 | { d_kbutton_proc, 167, 220, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "EX4", NULL, &Exkey4}, | ||
| 5623 | // 31 | ||
| 5624 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Akey}, | ||
| 5625 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Bkey}, | ||
| 5626 | { d_k_clearbutton_proc, 22+91, 156, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Skey}, | ||
| 5627 | { d_k_clearbutton_proc, 22+91, 188, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey1}, | ||
| 5628 | { d_k_clearbutton_proc, 22+91, 220, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey3}, | ||
| 5629 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Lkey}, | ||
| 5630 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Rkey}, | ||
| 5631 | { d_k_clearbutton_proc, 167+91, 156, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Pkey}, | ||
| 5632 | { d_k_clearbutton_proc, 167+91, 188, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey2}, | ||
| 5633 | { d_k_clearbutton_proc, 167+91, 220, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &Exkey4}, | ||
| 5634 | // Dirs | ||
| 5635 | // 41 | ||
| 5636 | { jwin_frame_proc, 14, 80, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5637 | { jwin_frame_proc, 159, 80, 147, 80, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5638 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Vertical", NULL, NULL }, | ||
| 5639 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Horizontal", NULL, NULL }, | ||
| 5640 | // 45 | ||
| 5641 | { jwin_text_proc, 92-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_up, NULL, NULL }, | ||
| 5642 | { jwin_text_proc, 92-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_down, NULL, NULL }, | ||
| 5643 | { jwin_text_proc, 237-4, 102, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_left, NULL, NULL }, | ||
| 5644 | { jwin_text_proc, 237-4, 130, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_right, NULL, NULL }, | ||
| 5645 | // 49 | ||
| 5646 | { d_kbutton_proc, 22, 100, 61, 21, vc(14), vc(11), 0, 0, 0, 0, (void *) "Up", NULL, &DUkey}, | ||
| 5647 | { d_kbutton_proc, 22, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Down", NULL, &DDkey}, | ||
| 5648 | { d_kbutton_proc, 167, 100, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Left", NULL, &DLkey}, | ||
| 5649 | { d_kbutton_proc, 167, 128, 61, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Right", NULL, &DRkey}, | ||
| 5650 | // 53 | ||
| 5651 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DUkey}, | ||
| 5652 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DDkey}, | ||
| 5653 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DLkey}, | ||
| 5654 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &DRkey}, | ||
| 5655 | // Mods | ||
| 5656 | // 57 | ||
| 5657 | { jwin_frame_proc, 14, 80, 148, 140-58, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5658 | { jwin_frame_proc, 158, 80, 148, 140-58, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5659 | { jwin_text_proc, 30, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Left", NULL, NULL }, | ||
| 5660 | { jwin_text_proc, 175, 86, 160, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Right", NULL, NULL }, | ||
| 5661 | // 61 | ||
| 5662 | { jwin_text_proc, 92-26, 101, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_leftmod1, NULL, NULL }, | ||
| 5663 | { jwin_text_proc, 92-26, 129, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_rightmod1, NULL, NULL }, | ||
| 5664 | { jwin_text_proc, 237-4-22,101, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_leftmod2, NULL, NULL }, | ||
| 5665 | { jwin_text_proc, 237-4-22,129, 60, 8, vc(7), vc(11), 0, 0, 0, 0, str_rightmod2, NULL, NULL }, | ||
| 5666 | // 65 | ||
| 5667 | { d_kbutton_proc, 22, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Main", NULL, &cheat_modifier_keys[0]}, | ||
| 5668 | { d_kbutton_proc, 22, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Second", NULL, &cheat_modifier_keys[2]}, | ||
| 5669 | { d_kbutton_proc, 167, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Main", NULL, &cheat_modifier_keys[1]}, | ||
| 5670 | { d_kbutton_proc, 167, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Second", NULL, &cheat_modifier_keys[3]}, | ||
| 5671 | // 69 | ||
| 5672 | { d_k_clearbutton_proc, 22+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[0]}, | ||
| 5673 | { d_k_clearbutton_proc, 22+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[2]}, | ||
| 5674 | { d_k_clearbutton_proc, 167+91, 100, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[1]}, | ||
| 5675 | { d_k_clearbutton_proc, 167+91, 128, 40, 21, vc(14), vc(1), 0, 0, 0, 0, (void *) "Clear", NULL, &cheat_modifier_keys[3]}, | ||
| 5676 | // 73 | ||
| 5677 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5678 | }; | ||
| 5679 | |||
| 5680 | int32_t midi_dp[3] = {0,0,0}; | ||
| 5681 | int32_t emus_dp[3] = {2,0,0}; | ||
| 5682 | int32_t sfx_dp[3] = {3,0,0}; | ||
| 5683 | int32_t pan_dp[3] = {0,0,0}; | ||
| 5684 | |||
| 5685 | static DIALOG sound_dlg[] = | ||
| 5686 | { | ||
| 5687 | //(dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) | ||
| 5688 | 427 | { jwin_win_proc, 0, 0, 320, 178, 0, 0, 0, D_EXIT, 0, 0, (void *) "Sound Settings", NULL, NULL }, | |
| 5689 | 427 | { d_stringloader, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5690 | 427 | { jwin_button_proc, 58, 148, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | |
| 5691 | 427 | { jwin_button_proc, 138, 148, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | |
| 5692 | 427 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5693 | 427 | { jwin_frame_proc, 10, 28, 300, 112, 0, 0, 0, 0, FR_ETCHED, 0, NULL, NULL, NULL }, | |
| 5694 | 427 | { jwin_rtext_proc, 190, 40, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_a, NULL, NULL }, | |
| 5695 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5696 | 427 | { jwin_rtext_proc, 190, 56, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_l, NULL, NULL }, | |
| 5697 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5698 | // 10 | ||
| 5699 | 427 | { jwin_rtext_proc, 190, 72, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_r, NULL, NULL }, | |
| 5700 | 427 | { jwin_rtext_proc, 190, 88, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_s, NULL, NULL }, | |
| 5701 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5702 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5703 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5704 | 427 | { jwin_slider_proc, 196, 40, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, midi_dp }, | |
| 5705 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5706 | 427 | { jwin_slider_proc, 196, 56, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, emus_dp }, | |
| 5707 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5708 | 427 | { jwin_slider_proc, 196, 72, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, sfx_dp }, | |
| 5709 | //20 | ||
| 5710 | 427 | { jwin_slider_proc, 196, 88, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 3, 0, NULL, (void *) set_pan, pan_dp }, | |
| 5711 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5712 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5713 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5714 | 427 | { jwin_text_proc, 17, 40, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "MIDI Volume", NULL, NULL }, | |
| 5715 | 427 | { jwin_text_proc, 17, 56, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Music Volume (Enhanced Music)", NULL, NULL }, | |
| 5716 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5717 | 427 | { jwin_text_proc, 17, 72, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Volume", NULL, NULL }, | |
| 5718 | 427 | { jwin_text_proc, 17, 88, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Pan", NULL, NULL }, | |
| 5719 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5720 | //30 | ||
| 5721 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5722 | 427 | { d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5723 | 427 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 5724 | }; | ||
| 5725 | |||
| 5726 | char zc_builddate[80]; | ||
| 5727 | char zc_aboutstr[80]; | ||
| 5728 | |||
| 5729 | static DIALOG about_dlg[] = | ||
| 5730 | { | ||
| 5731 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 5732 | { jwin_win_proc, 68, 52, 184, 154, 0, 0, 0, D_EXIT, 0, 0, (void *) "About", NULL, NULL }, | ||
| 5733 | { jwin_button_proc, 140, 176, 41, 21, vc(14), 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 5734 | { jwin_ctext_proc, 160, 84, 0, 8, vc(0), vc(11), 0, 0, 0, 0, zc_aboutstr, NULL, NULL }, | ||
| 5735 | { jwin_ctext_proc, 160, 92, 0, 8, vc(0) , vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5736 | { jwin_ctext_proc, 160, 100, 0, 8, vc(0) , vc(11), 0, 0, 0, 0, zc_builddate, NULL, NULL }, | ||
| 5737 | { jwin_text_proc, 88, 124, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Coded by:", NULL, NULL }, | ||
| 5738 | { jwin_text_proc, 88, 132, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) " Phantom Menace", NULL, NULL }, | ||
| 5739 | { jwin_text_proc, 88, 144, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Produced by:", NULL, NULL }, | ||
| 5740 | { jwin_text_proc, 88, 152, 140, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) " Armageddon Games", NULL, NULL }, | ||
| 5741 | { jwin_frame_proc, 80, 117, 160, 50, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5742 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5743 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5744 | }; | ||
| 5745 | |||
| 5746 | |||
| 5747 | static DIALOG quest_dlg[] = | ||
| 5748 | { | ||
| 5749 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 5750 | { jwin_win_proc, 68, 25, 184, 190, 0, 0, 0, D_EXIT, 0, 0, (void *) "Quest Info", NULL, NULL }, | ||
| 5751 | { jwin_edit_proc, 84, 54, 152, 16, 0, 0, 0, D_READONLY, 100, 0, NULL, NULL, NULL }, | ||
| 5752 | { jwin_text_proc, 89, 84, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Number:", NULL, NULL }, | ||
| 5753 | { jwin_text_proc, 152, 84, 24, 8, vc(7), vc(11), 0, 0, 0, 0, str_a, NULL, NULL }, | ||
| 5754 | { jwin_text_proc, 89, 94, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Version:", NULL, NULL }, | ||
| 5755 | { jwin_text_proc, 160, 94, 64, 8, vc(7), vc(11), 0, 0, 0, 0, header_version_nul_term, NULL, NULL }, | ||
| 5756 | { jwin_text_proc, 89, 104, 141, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "ZQ Version:", NULL, NULL }, | ||
| 5757 | { jwin_text_proc, 130, 104, 64, 8, vc(7), vc(11), 0, 0, 0, 0, str_s, NULL, NULL }, | ||
| 5758 | { jwin_text_proc, 84, 126, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Title:", NULL, NULL }, | ||
| 5759 | { jwin_textbox_proc, 84, 136, 152, 24, 0, 0, 0, 0, 0, 0, QHeader.title, NULL, NULL }, | ||
| 5760 | { jwin_text_proc, 84, 168, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Author:", NULL, NULL }, | ||
| 5761 | { jwin_textbox_proc, 84, 178, 152, 24, 0, 0, 0, 0, 0, 0, QHeader.author, NULL, NULL }, | ||
| 5762 | { jwin_frame_proc, 84, 79, 152, 38, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | ||
| 5763 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5764 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5765 | }; | ||
| 5766 | |||
| 5767 | static DIALOG triforce_dlg[] = | ||
| 5768 | { | ||
| 5769 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) */ | ||
| 5770 | { jwin_win_proc, 72, 64, 177, 105, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "Triforce Pieces", NULL, NULL }, | ||
| 5771 | // 1 | ||
| 5772 | { jwin_check_proc, 129, 94, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "1", NULL, NULL }, | ||
| 5773 | { jwin_check_proc, 129, 104, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "2", NULL, NULL }, | ||
| 5774 | { jwin_check_proc, 129, 114, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "3", NULL, NULL }, | ||
| 5775 | { jwin_check_proc, 129, 124, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "4", NULL, NULL }, | ||
| 5776 | { jwin_check_proc, 172, 94, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "5", NULL, NULL }, | ||
| 5777 | { jwin_check_proc, 172, 104, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "6", NULL, NULL }, | ||
| 5778 | { jwin_check_proc, 172, 114, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "7", NULL, NULL }, | ||
| 5779 | { jwin_check_proc, 172, 124, 24, 9, vc(0), vc(11), 0, 0, 1, 0, (void *) "8", NULL, NULL }, | ||
| 5780 | // 9 | ||
| 5781 | { jwin_button_proc, 90, 144, 61, 21, vc(0), vc(11), 'k', D_EXIT, 0, 0, (void *) "O&K", NULL, NULL }, | ||
| 5782 | { jwin_button_proc, 170, 144, 61, 21, vc(0), vc(11), 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 5783 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 5784 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 5785 | }; | ||
| 5786 | |||
| 5787 | ✗ | int32_t onToggleRecordingNewSaves() | |
| 5788 | { | ||
| 5789 | ✗ | if (zc_get_config("zeldadx", "replay_new_saves", false)) | |
| 5790 | { | ||
| 5791 | ✗ | zc_set_config("zeldadx", "replay_new_saves", false); | |
| 5792 | ✗ | } | |
| 5793 | else | ||
| 5794 | { | ||
| 5795 | ✗ | zc_set_config("zeldadx", "replay_new_saves", true); | |
| 5796 | ✗ | jwin_alert("Recording", "Newly created saves will be recorded and written to a replay file.", | |
| 5797 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5798 | } | ||
| 5799 | ✗ | return D_O_K; | |
| 5800 | } | ||
| 5801 | |||
| 5802 | #ifdef HAS_CURL | ||
| 5803 | ✗ | int32_t onToggleAutoUploadReplays() | |
| 5804 | { | ||
| 5805 | ✗ | if (zc_get_config("zeldadx", "replay_upload", false)) | |
| 5806 | { | ||
| 5807 | ✗ | zc_set_config("zeldadx", "replay_upload", false); | |
| 5808 | ✗ | } | |
| 5809 | else | ||
| 5810 | { | ||
| 5811 | ✗ | zc_set_config("zeldadx", "replay_upload", true); | |
| 5812 | ✗ | jwin_alert("Replays", "Replays will be automatically uploaded. This helps development by", | |
| 5813 | " preventing bugs and simplifying bug reports.", | ||
| 5814 | "Upload will happen no more than once a week when closing ZC", | ||
| 5815 | ✗ | "OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5816 | |||
| 5817 | ✗ | if (!zc_get_config("zeldadx", "replay_new_saves", false)) | |
| 5818 | ✗ | onToggleRecordingNewSaves(); | |
| 5819 | } | ||
| 5820 | ✗ | return D_O_K; | |
| 5821 | } | ||
| 5822 | |||
| 5823 | ✗ | int32_t onUploadReplays() | |
| 5824 | { | ||
| 5825 | ✗ | if(jwin_alert3( | |
| 5826 | "Upload replays", | ||
| 5827 | "Upload your replays now to assist in development?", | ||
| 5828 | NULL, | ||
| 5829 | NULL, | ||
| 5830 | "&Yes", | ||
| 5831 | "&No", | ||
| 5832 | NULL, | ||
| 5833 | 'y', | ||
| 5834 | 'n', | ||
| 5835 | 0, | ||
| 5836 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 5837 | { | ||
| 5838 | ✗ | int num_uploaded = replay_upload(); | |
| 5839 | ✗ | jwin_alert("Upload replays", fmt::format("Uploaded {} replays", num_uploaded).c_str(), | |
| 5840 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5841 | ✗ | } | |
| 5842 | ✗ | return D_O_K; | |
| 5843 | ✗ | } | |
| 5844 | |||
| 5845 | ✗ | int32_t onClearUploadCache() | |
| 5846 | { | ||
| 5847 | ✗ | if(jwin_alert3( | |
| 5848 | "Upload replays", | ||
| 5849 | "Clear the upload cache?", | ||
| 5850 | "This simply deletes replays/state.json. There's no harm in doing this, but", | ||
| 5851 | "likely is not necessary.", | ||
| 5852 | "&Yes", | ||
| 5853 | "&No", | ||
| 5854 | NULL, | ||
| 5855 | 'y', | ||
| 5856 | 'n', | ||
| 5857 | 0, | ||
| 5858 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 5859 | { | ||
| 5860 | ✗ | replay_upload_clear_cache(); | |
| 5861 | ✗ | } | |
| 5862 | ✗ | return D_O_K; | |
| 5863 | } | ||
| 5864 | #endif | ||
| 5865 | |||
| 5866 | ✗ | int32_t onToggleSnapshotAllFrames() | |
| 5867 | { | ||
| 5868 | ✗ | replay_set_snapshot_all_frames(!replay_is_snapshot_all_frames()); | |
| 5869 | ✗ | return D_O_K; | |
| 5870 | } | ||
| 5871 | |||
| 5872 | ✗ | int32_t onStopReplayOrRecord() | |
| 5873 | { | ||
| 5874 | ✗ | if (replay_is_replaying()) | |
| 5875 | { | ||
| 5876 | ✗ | replay_quit(); | |
| 5877 | ✗ | } | |
| 5878 | ✗ | else if (replay_get_mode() == ReplayMode::Record) | |
| 5879 | { | ||
| 5880 | ✗ | if (!replay_get_meta_bool("test_mode")) | |
| 5881 | { | ||
| 5882 | ✗ | jwin_alert("Recording", "You cannot stop recording a save file.", | |
| 5883 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5884 | ✗ | return D_CLOSE; | |
| 5885 | } | ||
| 5886 | |||
| 5887 | ✗ | if (jwin_alert("Stop Recording", | |
| 5888 | "Save replay to disk and stop recording?", | ||
| 5889 | "This will stop the recording.", | ||
| 5890 | NULL, | ||
| 5891 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 5892 | ✗ | return D_CLOSE; | |
| 5893 | |||
| 5894 | ✗ | replay_save(); | |
| 5895 | ✗ | replay_stop(); | |
| 5896 | ✗ | } | |
| 5897 | ✗ | return D_O_K; | |
| 5898 | ✗ | } | |
| 5899 | |||
| 5900 | ✗ | static int32_t handle_on_load_replay(ReplayMode mode) | |
| 5901 | { | ||
| 5902 | ✗ | bool ctrl = CHECK_CTRL_CMD; | |
| 5903 | ✗ | if (Playing) | |
| 5904 | { | ||
| 5905 | ✗ | if (jwin_alert("Replay - Warning!", | |
| 5906 | "Loading a replay will exit the current game.", | ||
| 5907 | "All unsaved progress will be lost.", | ||
| 5908 | "Do you wish to continue?", | ||
| 5909 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 5910 | ✗ | return D_CLOSE; | |
| 5911 | ✗ | } | |
| 5912 | |||
| 5913 | ✗ | std::string mode_string = replay_mode_to_string(mode); | |
| 5914 | ✗ | mode_string[0] = std::toupper(mode_string[0]); | |
| 5915 | |||
| 5916 | ✗ | std::string line_1 = "Select a replay file to play back."; | |
| 5917 | ✗ | std::string line_2 = "You won't be able to save, and it won't effect existing saves."; | |
| 5918 | ✗ | std::string line_3 = "You can stop the replay and take over manually any time."; | |
| 5919 | ✗ | if (mode == ReplayMode::Update) | |
| 5920 | { | ||
| 5921 | ✗ | line_1 = "Select a replay file to update."; | |
| 5922 | ✗ | line_2 = "WARNING: be sure to back up the zplay file"; | |
| 5923 | ✗ | line_3 = "and verify that the updated replay works as expected!"; | |
| 5924 | ✗ | } | |
| 5925 | |||
| 5926 | ✗ | if (jwin_alert(mode_string.c_str(), | |
| 5927 | ✗ | line_1.c_str(), | |
| 5928 | ✗ | line_2.c_str(), | |
| 5929 | ✗ | line_3.c_str(), | |
| 5930 | ✗ | "OK","Nevermind",13,27,get_zc_font(font_lfont)) == 1) | |
| 5931 | { | ||
| 5932 | ✗ | std::string replay_path = "replays/"; | |
| 5933 | ✗ | if(ctrl && devpwd()) | |
| 5934 | ✗ | replay_path = "../../tests/replays/"; | |
| 5935 | ✗ | std::string prompt = fmt::format("Load Replay ({})", REPLAY_EXTENSION); | |
| 5936 | ✗ | if (auto result = prompt_for_existing_file(prompt, REPLAY_EXTENSION, nullptr, replay_path)) | |
| 5937 | ✗ | replay_path = *result; | |
| 5938 | else | ||
| 5939 | ✗ | return D_CLOSE; | |
| 5940 | |||
| 5941 | ✗ | replay_quit(); | |
| 5942 | ✗ | load_replay_file_deferred(mode, replay_path); | |
| 5943 | ✗ | Quit = qRESET; | |
| 5944 | ✗ | return D_CLOSE; | |
| 5945 | ✗ | } | |
| 5946 | ✗ | return D_O_K; | |
| 5947 | ✗ | } | |
| 5948 | |||
| 5949 | ✗ | int32_t onLoadReplay() | |
| 5950 | { | ||
| 5951 | ✗ | return handle_on_load_replay(ReplayMode::Replay); | |
| 5952 | } | ||
| 5953 | |||
| 5954 | ✗ | int32_t onLoadReplayAssert() | |
| 5955 | { | ||
| 5956 | ✗ | return handle_on_load_replay(ReplayMode::Assert); | |
| 5957 | } | ||
| 5958 | |||
| 5959 | ✗ | int32_t onLoadReplayUpdate() | |
| 5960 | { | ||
| 5961 | ✗ | return handle_on_load_replay(ReplayMode::Update); | |
| 5962 | } | ||
| 5963 | |||
| 5964 | ✗ | int32_t onSaveReplay() | |
| 5965 | { | ||
| 5966 | ✗ | if (replay_get_mode() == ReplayMode::Record) | |
| 5967 | { | ||
| 5968 | ✗ | if (!replay_get_meta_bool("test_mode")) | |
| 5969 | { | ||
| 5970 | ✗ | if (jwin_alert("Save Replay", | |
| 5971 | "This will save a copy of the replay up to this point.", | ||
| 5972 | "The official replay file will be untouched.", | ||
| 5973 | "Do you wish to continue?", | ||
| 5974 | ✗ | "Yes","No",13,27,get_zc_font(font_lfont)) != 1) | |
| 5975 | { | ||
| 5976 | ✗ | return D_CLOSE; | |
| 5977 | } | ||
| 5978 | |||
| 5979 | ✗ | std::string replay_path = replay_get_replay_path().string(); | |
| 5980 | ✗ | std::string prompt = fmt::format("Save Replay ({})", REPLAY_EXTENSION); | |
| 5981 | ✗ | if (auto result = prompt_for_new_file(prompt, REPLAY_EXTENSION, nullptr, replay_path)) | |
| 5982 | ✗ | replay_path = *result; | |
| 5983 | else | ||
| 5984 | ✗ | return D_CLOSE; | |
| 5985 | |||
| 5986 | ✗ | if (fileexists(replay_path.c_str())) | |
| 5987 | { | ||
| 5988 | ✗ | jwin_alert("Save Replay", "You cannot overwrite an existing file.", | |
| 5989 | ✗ | NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 5990 | ✗ | return D_CLOSE; | |
| 5991 | } | ||
| 5992 | |||
| 5993 | ✗ | replay_save(replay_path); | |
| 5994 | ✗ | } | |
| 5995 | else | ||
| 5996 | { | ||
| 5997 | ✗ | replay_save(); | |
| 5998 | } | ||
| 5999 | ✗ | } | |
| 6000 | ✗ | return D_O_K; | |
| 6001 | ✗ | } | |
| 6002 | |||
| 6003 | enum | ||
| 6004 | { | ||
| 6005 | MENUID_REPLAY_RECORDNEW, | ||
| 6006 | MENUID_REPLAY_STOP, | ||
| 6007 | MENUID_REPLAY_SAVE, | ||
| 6008 | MENUID_REPLAY_SNAP_ALL, | ||
| 6009 | MENUID_REPLAY_AUTOUPLOAD, | ||
| 6010 | MENUID_REPLAY_UPLOAD, | ||
| 6011 | MENUID_REPLAY_CLEARUPLOADCACHE, | ||
| 6012 | }; | ||
| 6013 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu replay_menu |
| 6014 | 5551 | { | |
| 6015 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Record new saves", onToggleRecordingNewSaves, MENUID_REPLAY_RECORDNEW }, |
| 6016 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 6017 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Stop replay", onStopReplayOrRecord, MENUID_REPLAY_STOP }, |
| 6018 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Load replay", onLoadReplay }, |
| 6019 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Load replay (assert)", onLoadReplayAssert }, |
| 6020 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Load replay (update)", onLoadReplayUpdate }, |
| 6021 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Save replay", onSaveReplay, MENUID_REPLAY_SAVE }, |
| 6022 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Snapshot all frames", onToggleSnapshotAllFrames, MENUID_REPLAY_SNAP_ALL }, |
| 6023 | #ifdef HAS_CURL | ||
| 6024 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 6025 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Auto upload replays", onToggleAutoUploadReplays, MENUID_REPLAY_AUTOUPLOAD }, |
| 6026 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Upload replays", onUploadReplays, MENUID_REPLAY_UPLOAD }, |
| 6027 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Clear upload cache", onClearUploadCache, MENUID_REPLAY_CLEARUPLOADCACHE }, |
| 6028 | #endif | ||
| 6029 | }; | ||
| 6030 | |||
| 6031 | static DIALOG credits_dlg[] = | ||
| 6032 | { | ||
| 6033 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6034 | { jwin_win_proc, 40, 38, 241, 173, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "ZQuest Classic Credits", NULL, NULL }, | ||
| 6035 | { jwin_frame_proc, 47, 65, 227, 115, vc(15), vc(1), 0, 0, FR_DEEP, 0, NULL, NULL, NULL }, | ||
| 6036 | { d_bitmap_proc, 49, 67, 222, 110, vc(15), vc(1), 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6037 | { jwin_button_proc, 140, 184, 41, 21, vc(14), vc(1), 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 6038 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6039 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6040 | }; | ||
| 6041 | |||
| 6042 | 427 | static ListData dmap_list(dmaplist, &font); | |
| 6043 | |||
| 6044 | static DIALOG goto_dlg[] = | ||
| 6045 | { | ||
| 6046 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6047 | { jwin_win_proc, 48, 25, 205, 100, 0, 0, 0, D_EXIT, 0, 0, (void *) "Goto Location", NULL, NULL }, | ||
| 6048 | { jwin_button_proc, 90, 176-78, 61, 21, vc(14), 0, 13, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 6049 | { jwin_button_proc, 170, 176-78, 61, 21, vc(14), 0, 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 6050 | { jwin_text_proc, 55, 129-75, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "DMap:", NULL, NULL }, | ||
| 6051 | { jwin_droplist_proc, 88, 126-75, 160, 16, 0, 0, 0, 0, 0, 0, (void *) &dmap_list, NULL, NULL }, | ||
| 6052 | { jwin_text_proc, 55, 149-75, 80, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Screen:", NULL, NULL }, | ||
| 6053 | { jwin_edit_proc, 132, 146-75, 91, 16, 0, 0, 0, 0, 2, 0, NULL, NULL, NULL }, | ||
| 6054 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6055 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6056 | }; | ||
| 6057 | |||
| 6058 | ✗ | int32_t onGoTo() | |
| 6059 | { | ||
| 6060 | ✗ | bool music = false; | |
| 6061 | ✗ | music = music; | |
| 6062 | ✗ | sprintf(cheat_goto_screen_str,"%X",cheat_goto_screen); | |
| 6063 | |||
| 6064 | ✗ | goto_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6065 | ✗ | goto_dlg[4].d2=cheat_goto_dmap; | |
| 6066 | ✗ | goto_dlg[6].dp=cheat_goto_screen_str; | |
| 6067 | |||
| 6068 | ✗ | clear_keybuf(); | |
| 6069 | |||
| 6070 | ✗ | large_dialog(goto_dlg); | |
| 6071 | |||
| 6072 | ✗ | if(do_zqdialog(goto_dlg,4)==1) | |
| 6073 | { | ||
| 6074 | ✗ | int dmap = goto_dlg[4].d2; | |
| 6075 | ✗ | int screen = zc_xtoi(cheat_goto_screen_str); | |
| 6076 | ✗ | int adjusted_screen = screen + DMaps[dmap].xoff; | |
| 6077 | ✗ | if (adjusted_screen < 0 || adjusted_screen >= 128) | |
| 6078 | { | ||
| 6079 | ✗ | InfoDialog("Invalid screen", fmt::format("The screen {:02X} is out of bounds.", adjusted_screen)).show(); | |
| 6080 | ✗ | } | |
| 6081 | else | ||
| 6082 | { | ||
| 6083 | ✗ | cheats_enqueue(Cheat::GoTo, dmap, screen); | |
| 6084 | } | ||
| 6085 | ✗ | }; | |
| 6086 | |||
| 6087 | ✗ | return D_O_K; | |
| 6088 | ✗ | } | |
| 6089 | |||
| 6090 | ✗ | int32_t onGoToComplete() | |
| 6091 | { | ||
| 6092 | ✗ | if(!Playing) | |
| 6093 | { | ||
| 6094 | ✗ | return D_O_K; | |
| 6095 | } | ||
| 6096 | |||
| 6097 | ✗ | enter_sys_pal(); | |
| 6098 | ✗ | music_pause(); | |
| 6099 | ✗ | pause_all_sfx(); | |
| 6100 | ✗ | onGoTo(); | |
| 6101 | ✗ | eat_buttons(); | |
| 6102 | |||
| 6103 | ✗ | zc_readrawkey(KEY_ESC); | |
| 6104 | |||
| 6105 | ✗ | exit_sys_pal(); | |
| 6106 | ✗ | music_resume(); | |
| 6107 | ✗ | resume_all_sfx(); | |
| 6108 | ✗ | return D_O_K; | |
| 6109 | ✗ | } | |
| 6110 | |||
| 6111 | ✗ | int32_t onCredits() | |
| 6112 | { | ||
| 6113 | ✗ | return D_O_K; | |
| 6114 | } | ||
| 6115 | |||
| 6116 | ✗ | const char *midilist(int32_t index, int32_t *list_size) | |
| 6117 | { | ||
| 6118 | ✗ | if(index<0) | |
| 6119 | { | ||
| 6120 | ✗ | *list_size=0; | |
| 6121 | |||
| 6122 | ✗ | for(int32_t i=0; i<MAXMIDIS; i++) | |
| 6123 | ✗ | if(tunes[i].data) | |
| 6124 | ✗ | ++(*list_size); | |
| 6125 | |||
| 6126 | ✗ | return NULL; | |
| 6127 | } | ||
| 6128 | |||
| 6129 | ✗ | int32_t i=0,m=0; | |
| 6130 | |||
| 6131 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6132 | { | ||
| 6133 | ✗ | if(tunes[i].data) | |
| 6134 | ✗ | ++m; | |
| 6135 | |||
| 6136 | ✗ | ++i; | |
| 6137 | } | ||
| 6138 | |||
| 6139 | ✗ | --i; | |
| 6140 | |||
| 6141 | ✗ | if(i==MAXMIDIS && m<index) | |
| 6142 | ✗ | return "(null)"; | |
| 6143 | |||
| 6144 | ✗ | return tunes[i].title; | |
| 6145 | ✗ | } | |
| 6146 | |||
| 6147 | /* ------- MIDI info stuff -------- */ | ||
| 6148 | |||
| 6149 | char *text; | ||
| 6150 | midi_info *zmi; | ||
| 6151 | bool dialog_running; | ||
| 6152 | bool listening; | ||
| 6153 | |||
| 6154 | void get_info(int32_t index); | ||
| 6155 | |||
| 6156 | ✗ | int32_t d_midilist_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6157 | { | ||
| 6158 | ✗ | int32_t d2 = d->d2; | |
| 6159 | ✗ | int32_t ret = jwin_droplist_proc(msg,d,c); | |
| 6160 | |||
| 6161 | ✗ | if(d2!=d->d2) | |
| 6162 | { | ||
| 6163 | ✗ | get_info(d->d2); | |
| 6164 | ✗ | } | |
| 6165 | |||
| 6166 | ✗ | return ret; | |
| 6167 | } | ||
| 6168 | |||
| 6169 | ✗ | int32_t d_listen_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6170 | { | ||
| 6171 | /* 'd->d1' is offset from 'd' in DIALOG array to midilist proc */ | ||
| 6172 | |||
| 6173 | ✗ | int32_t ret = jwin_button_proc(msg,d,c); | |
| 6174 | |||
| 6175 | ✗ | if(ret == D_CLOSE) | |
| 6176 | { | ||
| 6177 | // get current midi index | ||
| 6178 | ✗ | int32_t index = (d+(d->d1))->d2; | |
| 6179 | ✗ | int32_t i=0, m=0; | |
| 6180 | |||
| 6181 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6182 | { | ||
| 6183 | ✗ | if(tunes[i].data) | |
| 6184 | ✗ | ++m; | |
| 6185 | |||
| 6186 | ✗ | ++i; | |
| 6187 | } | ||
| 6188 | |||
| 6189 | ✗ | --i; | |
| 6190 | ✗ | jukebox(i); | |
| 6191 | ✗ | listening = true; | |
| 6192 | ✗ | ret = D_O_K; | |
| 6193 | ✗ | } | |
| 6194 | |||
| 6195 | ✗ | return ret; | |
| 6196 | } | ||
| 6197 | |||
| 6198 | ✗ | int32_t d_savemidi_proc(int32_t msg,DIALOG *d,int32_t c) | |
| 6199 | { | ||
| 6200 | /* 'd->d1' is offset from 'd' in DIALOG array to midilist proc */ | ||
| 6201 | |||
| 6202 | ✗ | int32_t ret = jwin_button_proc(msg,d,c); | |
| 6203 | |||
| 6204 | ✗ | if(ret == D_CLOSE) | |
| 6205 | { | ||
| 6206 | // get current midi index | ||
| 6207 | ✗ | int32_t index = (d+(d->d1))->d2; | |
| 6208 | ✗ | int32_t i=0, m=0; | |
| 6209 | |||
| 6210 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6211 | { | ||
| 6212 | ✗ | if(tunes[i].data) | |
| 6213 | ✗ | ++m; | |
| 6214 | |||
| 6215 | ✗ | ++i; | |
| 6216 | } | ||
| 6217 | |||
| 6218 | ✗ | --i; | |
| 6219 | |||
| 6220 | ✗ | char title[40] = "Save MIDI: "; | |
| 6221 | static EXT_LIST list[] = | ||
| 6222 | { | ||
| 6223 | { (char *)"MIDI files (*.mid)", (char *)"mid" }, | ||
| 6224 | { NULL, NULL } | ||
| 6225 | }; | ||
| 6226 | |||
| 6227 | ✗ | strcpy(title+11, tunes[i].title); | |
| 6228 | ✗ | title[39] = '\0'; | |
| 6229 | |||
| 6230 | ✗ | std::string fname; | |
| 6231 | ✗ | if (auto result = prompt_for_new_file(title, "", list, "tune.mid")) | |
| 6232 | ✗ | fname = *result; | |
| 6233 | else | ||
| 6234 | ✗ | goto done; | |
| 6235 | |||
| 6236 | ✗ | if(exists(fname.c_str())) | |
| 6237 | { | ||
| 6238 | ✗ | if(jwin_alert(title, fname.c_str(), "already exists.", "Overwrite it?", "&Yes","&No",'y','n',get_zc_font(font_lfont))==2) | |
| 6239 | ✗ | goto done; | |
| 6240 | ✗ | } | |
| 6241 | |||
| 6242 | // save midi i | ||
| 6243 | |||
| 6244 | ✗ | if (save_midi(fname.c_str(), tunes[i].data) != 0) | |
| 6245 | ✗ | jwin_alert(title, "Error saving MIDI to", fname.c_str(), NULL, "Darn", NULL,13,27,get_zc_font(font_lfont)); | |
| 6246 | |||
| 6247 | done: | ||
| 6248 | ✗ | chop_path(fname.data()); | |
| 6249 | ✗ | ret = D_REDRAW; | |
| 6250 | ✗ | } | |
| 6251 | |||
| 6252 | ✗ | return ret; | |
| 6253 | ✗ | } | |
| 6254 | |||
| 6255 | 427 | static ListData midi_list(midilist, &font); | |
| 6256 | |||
| 6257 | static DIALOG midi_dlg[] = | ||
| 6258 | { | ||
| 6259 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 6260 | { jwin_win_proc, 8, 28, 304, 184, 0, 0, 0, D_EXIT, 0, 0, (void *) "MIDI Info", NULL, NULL }, | ||
| 6261 | { jwin_text_proc, 32, 60, 40, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Tune:", NULL, NULL }, | ||
| 6262 | { d_midilist_proc, 80, 56, 192, 16, 0, 0, 0, 0, 0, 0, (void *) &midi_list, NULL, NULL }, | ||
| 6263 | { jwin_textbox_proc, 15, 80, 290, 96, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6264 | { d_listen_proc, 24, 183, 72, 21, 0, 0, 'l', D_EXIT, -2, 0, (void *) "&Listen", NULL, NULL }, | ||
| 6265 | { d_savemidi_proc, 108, 183, 72, 21, 0, 0, 's', D_EXIT, -3, 0, (void *) "&Save", NULL, NULL }, | ||
| 6266 | { jwin_button_proc, 236, 183, 61, 21, 0, 0, 'k', D_EXIT, 0, 0, (void *) "O&K", NULL, NULL }, | ||
| 6267 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6268 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6269 | }; | ||
| 6270 | |||
| 6271 | ✗ | void get_info(int32_t index) | |
| 6272 | { | ||
| 6273 | ✗ | int32_t i=0, m=0; | |
| 6274 | |||
| 6275 | ✗ | while(m<=index && i<=MAXMIDIS) | |
| 6276 | { | ||
| 6277 | ✗ | if(tunes[i].data) | |
| 6278 | ✗ | ++m; | |
| 6279 | |||
| 6280 | ✗ | ++i; | |
| 6281 | } | ||
| 6282 | |||
| 6283 | ✗ | --i; | |
| 6284 | |||
| 6285 | ✗ | if(i==MAXMIDIS && m<index) | |
| 6286 | ✗ | strcpy(text,"(null)"); | |
| 6287 | else | ||
| 6288 | { | ||
| 6289 | ✗ | get_midi_info(tunes[i].data,zmi); | |
| 6290 | ✗ | get_midi_text(tunes[i].data,zmi,text); | |
| 6291 | } | ||
| 6292 | |||
| 6293 | ✗ | midi_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6294 | ✗ | midi_dlg[3].dp = text; | |
| 6295 | ✗ | midi_dlg[3].d1 = midi_dlg[3].d2 = 0; | |
| 6296 | ✗ | midi_dlg[5].flags = (tunes[i].flags&tfDISABLESAVE) ? D_DISABLED : D_EXIT; | |
| 6297 | |||
| 6298 | ✗ | if(dialog_running) | |
| 6299 | { | ||
| 6300 | ✗ | jwin_textbox_proc(MSG_DRAW,midi_dlg+3,0); | |
| 6301 | ✗ | d_savemidi_proc(MSG_DRAW,midi_dlg+5,0); | |
| 6302 | ✗ | } | |
| 6303 | ✗ | } | |
| 6304 | |||
| 6305 | ✗ | int32_t onMIDICredits() | |
| 6306 | { | ||
| 6307 | ✗ | text = (char*)malloc(4096); | |
| 6308 | ✗ | zmi = (midi_info*)malloc(sizeof(midi_info)); | |
| 6309 | |||
| 6310 | ✗ | if(!text || !zmi) | |
| 6311 | { | ||
| 6312 | ✗ | jwin_alert(NULL,"Not enough memory",NULL,NULL,"OK",NULL,13,27,get_zc_font(font_lfont)); | |
| 6313 | ✗ | return D_O_K; | |
| 6314 | } | ||
| 6315 | |||
| 6316 | ✗ | bool do_pause_midi = midi_pos >= 0 && currmidi; | |
| 6317 | ✗ | auto restore_midi = currmidi; | |
| 6318 | ✗ | if(do_pause_midi) | |
| 6319 | { | ||
| 6320 | ✗ | paused_midi_pos = midi_pos; | |
| 6321 | ✗ | stop_midi(); | |
| 6322 | ✗ | midi_suspended = midissuspHALTED; | |
| 6323 | ✗ | } | |
| 6324 | |||
| 6325 | ✗ | midi_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6326 | ✗ | midi_dlg[2].d1 = 0; | |
| 6327 | ✗ | midi_dlg[2].d2 = 0; | |
| 6328 | ✗ | midi_dlg[4].flags = D_EXIT; | |
| 6329 | ✗ | midi_dlg[5].flags = (tunes[midi_dlg[2].d1].flags&tfDISABLESAVE) ? D_DISABLED : D_EXIT; | |
| 6330 | |||
| 6331 | ✗ | listening = false; | |
| 6332 | ✗ | dialog_running=false; | |
| 6333 | ✗ | get_info(0); | |
| 6334 | |||
| 6335 | ✗ | dialog_running=true; | |
| 6336 | |||
| 6337 | ✗ | large_dialog(midi_dlg); | |
| 6338 | |||
| 6339 | ✗ | do_zqdialog(midi_dlg,0); | |
| 6340 | ✗ | dialog_running=false; | |
| 6341 | |||
| 6342 | ✗ | if(listening) | |
| 6343 | ✗ | music_stop(); | |
| 6344 | |||
| 6345 | ✗ | if(do_pause_midi) | |
| 6346 | { | ||
| 6347 | // TODO: this probably doesn't resume midis nicely when scrolling (or in some other inner-gameloop). | ||
| 6348 | ✗ | midi_suspended = midissuspRESUME; | |
| 6349 | ✗ | currmidi = restore_midi; | |
| 6350 | ✗ | midi_pos = paused_midi_pos; | |
| 6351 | ✗ | } | |
| 6352 | |||
| 6353 | ✗ | if(text) free(text); | |
| 6354 | ✗ | if(zmi) free(zmi); | |
| 6355 | ✗ | return D_O_K; | |
| 6356 | ✗ | } | |
| 6357 | |||
| 6358 | ✗ | int32_t onAbout() | |
| 6359 | { | ||
| 6360 | ✗ | char buf1[80]={0}; | |
| 6361 | ✗ | std::ostringstream oss; | |
| 6362 | ✗ | sprintf(buf1,"ZQuest Classic Player"); | |
| 6363 | ✗ | oss << buf1 << '\n'; | |
| 6364 | ✗ | sprintf(buf1,"Version: %s", getVersionString()); | |
| 6365 | ✗ | oss << buf1 << '\n'; | |
| 6366 | ✗ | sprintf(buf1,"Build Date: %s %s, %d at @ %s %s", dayextension(BUILDTM_DAY).c_str(), (char*)months[BUILDTM_MONTH], BUILDTM_YEAR, __TIME__, __TIMEZONE__); | |
| 6367 | ✗ | oss << buf1 << '\n'; | |
| 6368 | |||
| 6369 | ✗ | InfoDialog("About ZC", oss.str()).show(); | |
| 6370 | return D_O_K; | ||
| 6371 | ✗ | } | |
| 6372 | |||
| 6373 | ✗ | int32_t onQuest() | |
| 6374 | { | ||
| 6375 | char fname[100]; | ||
| 6376 | ✗ | strcpy(fname, get_filename(qstpath)); | |
| 6377 | ✗ | quest_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6378 | ✗ | quest_dlg[1].dp = fname; | |
| 6379 | |||
| 6380 | ✗ | if(QHeader.quest_number==0) | |
| 6381 | ✗ | sprintf(str_a,"Custom"); | |
| 6382 | else | ||
| 6383 | ✗ | sprintf(str_a,"%d",QHeader.quest_number); | |
| 6384 | |||
| 6385 | ✗ | sprintf(str_s,"%s",QHeader.getVerStr()); | |
| 6386 | |||
| 6387 | ✗ | quest_dlg[11].d1 = quest_dlg[9].d1 = 0; | |
| 6388 | ✗ | quest_dlg[11].d2 = quest_dlg[9].d2 = 0; | |
| 6389 | |||
| 6390 | ✗ | large_dialog(quest_dlg); | |
| 6391 | |||
| 6392 | ✗ | do_zqdialog(quest_dlg, 0); | |
| 6393 | ✗ | return D_O_K; | |
| 6394 | } | ||
| 6395 | |||
| 6396 | void call_vidmode_dlg(); | ||
| 6397 | ✗ | int32_t onVidMode() | |
| 6398 | { | ||
| 6399 | ✗ | call_vidmode_dlg(); | |
| 6400 | ✗ | return D_O_K; | |
| 6401 | } | ||
| 6402 | |||
| 6403 | #define addToHash(c,b,h) if(h->find(c ## key) == h->end()) \ | ||
| 6404 | {(*h)[c ## key]=true;} else { if ( c ## key != 0 ) b = false;} | ||
| 6405 | //Added an extra statement, so that if the key is cleared to 0, the cleared | ||
| 6406 | //keybinding status need not be unique. -Z ( 1st April, 2019 ) | ||
| 6407 | |||
| 6408 | ✗ | void load_ukeys(int32_t* arr) | |
| 6409 | { | ||
| 6410 | ✗ | arr[ukey_a] = Akey; | |
| 6411 | ✗ | arr[ukey_b] = Bkey; | |
| 6412 | ✗ | arr[ukey_s] = Skey; | |
| 6413 | ✗ | arr[ukey_l] = Lkey; | |
| 6414 | ✗ | arr[ukey_r] = Rkey; | |
| 6415 | ✗ | arr[ukey_p] = Pkey; | |
| 6416 | ✗ | arr[ukey_ex1] = Exkey1; | |
| 6417 | ✗ | arr[ukey_ex2] = Exkey2; | |
| 6418 | ✗ | arr[ukey_ex3] = Exkey3; | |
| 6419 | ✗ | arr[ukey_ex4] = Exkey4; | |
| 6420 | ✗ | arr[ukey_du] = DUkey; | |
| 6421 | ✗ | arr[ukey_dd] = DDkey; | |
| 6422 | ✗ | arr[ukey_dl] = DLkey; | |
| 6423 | ✗ | arr[ukey_dr] = DRkey; | |
| 6424 | ✗ | arr[ukey_mod1a] = cheat_modifier_keys[0]; | |
| 6425 | ✗ | arr[ukey_mod1b] = cheat_modifier_keys[1]; | |
| 6426 | ✗ | arr[ukey_mod2a] = cheat_modifier_keys[2]; | |
| 6427 | ✗ | arr[ukey_mod2b] = cheat_modifier_keys[3]; | |
| 6428 | ✗ | }; | |
| 6429 | |||
| 6430 | static const char* ukey_names[] = { | ||
| 6431 | "A", "B", "Start", "L", "R", "Map", | ||
| 6432 | "Ex1", "Ex2", "Ex3", "Ex4", "Up", "Down", | ||
| 6433 | "Left", "Right", "Cheat Mod L1", "Cheat Mod L2", | ||
| 6434 | "Cheat Mod R1", "Cheat Mod R2", | ||
| 6435 | }; | ||
| 6436 | ✗ | std::string get_ukey_name(int32_t k) | |
| 6437 | { | ||
| 6438 | ✗ | if (k < num_ukey) return ukey_names[k]; | |
| 6439 | ✗ | return ""; | |
| 6440 | ✗ | } | |
| 6441 | |||
| 6442 | ✗ | int32_t onKeyboard() | |
| 6443 | { | ||
| 6444 | ✗ | int32_t a = Akey; | |
| 6445 | ✗ | int32_t b = Bkey; | |
| 6446 | ✗ | int32_t s = Skey; | |
| 6447 | ✗ | int32_t l = Lkey; | |
| 6448 | ✗ | int32_t r = Rkey; | |
| 6449 | ✗ | int32_t p = Pkey; | |
| 6450 | ✗ | int32_t ex1 = Exkey1; | |
| 6451 | ✗ | int32_t ex2 = Exkey2; | |
| 6452 | ✗ | int32_t ex3 = Exkey3; | |
| 6453 | ✗ | int32_t ex4 = Exkey4; | |
| 6454 | ✗ | int32_t du = DUkey; | |
| 6455 | ✗ | int32_t dd = DDkey; | |
| 6456 | ✗ | int32_t dl = DLkey; | |
| 6457 | ✗ | int32_t dr = DRkey; | |
| 6458 | ✗ | int32_t mod1a = cheat_modifier_keys[0]; | |
| 6459 | ✗ | int32_t mod1b = cheat_modifier_keys[1]; | |
| 6460 | ✗ | int32_t mod2a = cheat_modifier_keys[2]; | |
| 6461 | ✗ | int32_t mod2b = cheat_modifier_keys[3]; | |
| 6462 | ✗ | bool done=false; | |
| 6463 | int32_t ret; | ||
| 6464 | |||
| 6465 | ✗ | keyboard_control_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6466 | |||
| 6467 | ✗ | large_dialog(keyboard_control_dlg); | |
| 6468 | |||
| 6469 | ✗ | while(!done) | |
| 6470 | { | ||
| 6471 | ✗ | ret = do_zqdialog(keyboard_control_dlg,3); | |
| 6472 | |||
| 6473 | ✗ | if(ret==3) // OK | |
| 6474 | { | ||
| 6475 | int32_t ukeys[num_ukey]; | ||
| 6476 | ✗ | load_ukeys(ukeys); | |
| 6477 | ✗ | std::vector<std::string> uniqueError; | |
| 6478 | ✗ | for(int32_t q = 0; q < num_ukey; ++q) | |
| 6479 | { | ||
| 6480 | ✗ | for(int32_t p = q+1; p < num_ukey; ++p) | |
| 6481 | { | ||
| 6482 | ✗ | if(ukeys[q] == ukeys[p] && ukeys[q] != 0) | |
| 6483 | { | ||
| 6484 | char buf[64]; | ||
| 6485 | ✗ | sprintf(buf, "'%s' conflicts with '%s'", get_ukey_name(q).c_str(), get_ukey_name(p).c_str()); | |
| 6486 | ✗ | std::string str(buf); | |
| 6487 | ✗ | uniqueError.push_back(str); | |
| 6488 | ✗ | } | |
| 6489 | ✗ | } | |
| 6490 | ✗ | } | |
| 6491 | ✗ | if(uniqueError.size() == 0) | |
| 6492 | { | ||
| 6493 | ✗ | done = true; | |
| 6494 | ✗ | save_control_configs(true); | |
| 6495 | ✗ | } | |
| 6496 | else | ||
| 6497 | { | ||
| 6498 | ✗ | box_start(1, "Duplicate Keys", get_zc_font(font_lfont), get_zc_font(font_sfont), false, keyboard_control_dlg[0].w,keyboard_control_dlg[0].h, 2); | |
| 6499 | ✗ | box_out("Cannot have duplicate keybinds!"); box_eol(); | |
| 6500 | ✗ | for(std::vector<std::string>::iterator it = uniqueError.begin(); | |
| 6501 | ✗ | it != uniqueError.end(); ++it) | |
| 6502 | { | ||
| 6503 | ✗ | box_out((*it).c_str()); box_eol(); | |
| 6504 | ✗ | } | |
| 6505 | ✗ | box_end(true); | |
| 6506 | } | ||
| 6507 | ✗ | } | |
| 6508 | else // Cancel | ||
| 6509 | { | ||
| 6510 | ✗ | Akey = a; | |
| 6511 | ✗ | Bkey = b; | |
| 6512 | ✗ | Skey = s; | |
| 6513 | ✗ | Lkey = l; | |
| 6514 | ✗ | Rkey = r; | |
| 6515 | ✗ | Pkey = p; | |
| 6516 | ✗ | Exkey1 = ex1; | |
| 6517 | ✗ | Exkey2 = ex2; | |
| 6518 | ✗ | Exkey3 = ex3; | |
| 6519 | ✗ | Exkey4 = ex4; | |
| 6520 | ✗ | DUkey = du; | |
| 6521 | ✗ | DDkey = dd; | |
| 6522 | ✗ | DLkey = dl; | |
| 6523 | ✗ | DRkey = dr; | |
| 6524 | ✗ | cheat_modifier_keys[0] = mod1a; | |
| 6525 | ✗ | cheat_modifier_keys[1] = mod1b; | |
| 6526 | ✗ | cheat_modifier_keys[2] = mod2a; | |
| 6527 | ✗ | cheat_modifier_keys[3] = mod2b; | |
| 6528 | |||
| 6529 | ✗ | done=true; | |
| 6530 | } | ||
| 6531 | |||
| 6532 | ✗ | rest(1); | |
| 6533 | } | ||
| 6534 | |||
| 6535 | ✗ | return D_O_K; | |
| 6536 | ✗ | } | |
| 6537 | |||
| 6538 | ✗ | int32_t onGamepad() | |
| 6539 | { | ||
| 6540 | ✗ | if (al_get_num_joysticks() == 0) | |
| 6541 | { | ||
| 6542 | ✗ | InfoDialog("ZC", "No gamepads detected.").show(); | |
| 6543 | ✗ | return D_O_K; | |
| 6544 | } | ||
| 6545 | |||
| 6546 | ✗ | int32_t a = Abtn; | |
| 6547 | ✗ | int32_t b = Bbtn; | |
| 6548 | ✗ | int32_t s = Sbtn; | |
| 6549 | ✗ | int32_t l = Lbtn; | |
| 6550 | ✗ | int32_t r = Rbtn; | |
| 6551 | ✗ | int32_t m = Mbtn; | |
| 6552 | ✗ | int32_t p = Pbtn; | |
| 6553 | ✗ | int32_t ex1 = Exbtn1; | |
| 6554 | ✗ | int32_t ex2 = Exbtn2; | |
| 6555 | ✗ | int32_t ex3 = Exbtn3; | |
| 6556 | ✗ | int32_t ex4 = Exbtn4; | |
| 6557 | ✗ | int32_t up = DUbtn; | |
| 6558 | ✗ | int32_t down = DDbtn; | |
| 6559 | ✗ | int32_t left = DLbtn; | |
| 6560 | ✗ | int32_t right = DRbtn; | |
| 6561 | ✗ | int32_t joy = joystick_index; | |
| 6562 | ✗ | int32_t stick_1 = js_stick_1_x_stick; | |
| 6563 | ✗ | int32_t stick_2 = js_stick_2_x_stick; | |
| 6564 | |||
| 6565 | ✗ | gamepad_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6566 | ✗ | if(analog_movement) | |
| 6567 | ✗ | gamepad_dlg[56].flags|=D_SELECTED; | |
| 6568 | else | ||
| 6569 | ✗ | gamepad_dlg[56].flags&=~D_SELECTED; | |
| 6570 | |||
| 6571 | // TODO: should use controller device GUID or name instead of index, otherwise this value is not | ||
| 6572 | // consistent unless exact same number of joysticks is always connected. Name is problematic b/c | ||
| 6573 | // xinput driver doesn't actually get a name (at least, doesn't for my Xbox controller). | ||
| 6574 | // TODO: should store gamepad control mappings per-controller, otherwise switching joystick | ||
| 6575 | // requires remapping every time. | ||
| 6576 | ✗ | if (joystick_index >= al_get_num_joysticks()) | |
| 6577 | ✗ | joystick_index = 0; | |
| 6578 | ✗ | gamepad_dlg[61].d2 = joystick_index; | |
| 6579 | |||
| 6580 | ✗ | gamepad_dlg_cur_joystick = al_get_joystick(joystick_index); | |
| 6581 | ✗ | if (!gamepad_dlg_cur_joystick) | |
| 6582 | { | ||
| 6583 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 6584 | ✗ | return D_CLOSE; | |
| 6585 | } | ||
| 6586 | |||
| 6587 | ✗ | large_dialog(gamepad_dlg); | |
| 6588 | |||
| 6589 | ✗ | int32_t ret = do_zqdialog(gamepad_dlg,4); | |
| 6590 | |||
| 6591 | ✗ | if(ret == 4) //OK | |
| 6592 | { | ||
| 6593 | ✗ | analog_movement = gamepad_dlg[56].flags&D_SELECTED; | |
| 6594 | ✗ | joystick_index = gamepad_dlg[61].d2; | |
| 6595 | ✗ | gamepad_dlg_cur_joystick = al_get_joystick(joystick_index); | |
| 6596 | ✗ | if (!gamepad_dlg_cur_joystick) | |
| 6597 | { | ||
| 6598 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 6599 | ✗ | return D_CLOSE; | |
| 6600 | } | ||
| 6601 | ✗ | js_stick_1_y_stick = js_stick_1_x_stick; | |
| 6602 | ✗ | js_stick_2_y_stick = js_stick_2_x_stick; | |
| 6603 | ✗ | save_control_configs(false); | |
| 6604 | ✗ | } | |
| 6605 | else //Cancel | ||
| 6606 | { | ||
| 6607 | ✗ | Abtn = a; | |
| 6608 | ✗ | Bbtn = b; | |
| 6609 | ✗ | Sbtn = s; | |
| 6610 | ✗ | Lbtn = l; | |
| 6611 | ✗ | Rbtn = r; | |
| 6612 | ✗ | Mbtn = m; | |
| 6613 | ✗ | Pbtn = p; | |
| 6614 | ✗ | Exbtn1 = ex1; | |
| 6615 | ✗ | Exbtn2 = ex2; | |
| 6616 | ✗ | Exbtn3 = ex3; | |
| 6617 | ✗ | Exbtn4 = ex4; | |
| 6618 | ✗ | DUbtn = up; | |
| 6619 | ✗ | DDbtn = down; | |
| 6620 | ✗ | DLbtn = left; | |
| 6621 | ✗ | DRbtn = right; | |
| 6622 | ✗ | joystick_index = joy; | |
| 6623 | ✗ | js_stick_1_x_stick = stick_1; | |
| 6624 | ✗ | js_stick_2_x_stick = stick_2; | |
| 6625 | } | ||
| 6626 | |||
| 6627 | ✗ | return D_O_K; | |
| 6628 | ✗ | } | |
| 6629 | |||
| 6630 | ✗ | int32_t onCheatKeys() | |
| 6631 | { | ||
| 6632 | int32_t oldcheats[Cheat::Last][2]; | ||
| 6633 | ✗ | memcpy(oldcheats, cheatkeys, sizeof(cheatkeys)); | |
| 6634 | |||
| 6635 | ✗ | bool done=false; | |
| 6636 | |||
| 6637 | ✗ | while(!done) | |
| 6638 | { | ||
| 6639 | ✗ | bool confirm = false; | |
| 6640 | ✗ | CheatKeysDialog(&confirm).show(); | |
| 6641 | ✗ | if(confirm) // OK | |
| 6642 | { | ||
| 6643 | ✗ | std::vector<std::string> uniqueError; | |
| 6644 | char buf[512]; | ||
| 6645 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 6646 | { | ||
| 6647 | ✗ | if(cheatkeys[q][1] && !cheatkeys[q][0]) | |
| 6648 | { | ||
| 6649 | ✗ | cheatkeys[q][0] = cheatkeys[q][1]; | |
| 6650 | ✗ | cheatkeys[q][1] = 0; | |
| 6651 | ✗ | } | |
| 6652 | ✗ | } | |
| 6653 | ✗ | for(size_t q = 1; q < Cheat::Last; ++q) | |
| 6654 | { | ||
| 6655 | ✗ | if(!bindable_cheat((Cheat)q)) continue; | |
| 6656 | ✗ | for(size_t p = q+1; p < Cheat::Last; ++p) | |
| 6657 | { | ||
| 6658 | ✗ | if(!bindable_cheat((Cheat)p)) continue; | |
| 6659 | ✗ | for(size_t q2 = 0; q2 <= 1; ++q2) | |
| 6660 | ✗ | for(size_t p2 = 0; p2 <= 1; ++p2) | |
| 6661 | { | ||
| 6662 | ✗ | if(cheatkeys[q][q2] == cheatkeys[p][p2] && cheatkeys[q][q2] != 0) | |
| 6663 | { | ||
| 6664 | ✗ | uniqueError.push_back(fmt::format("'{}' ({}) conflicts with '{}' ({}) - both '{}'", | |
| 6665 | ✗ | cheat_to_string((Cheat)q), q2?"Alt":"Main", | |
| 6666 | ✗ | cheat_to_string((Cheat)p), p2?"Alt":"Main", | |
| 6667 | ✗ | get_keystr(cheatkeys[q][q2]))); | |
| 6668 | ✗ | } | |
| 6669 | ✗ | } | |
| 6670 | ✗ | } | |
| 6671 | ✗ | } | |
| 6672 | ✗ | if(uniqueError.size() == 0) | |
| 6673 | { | ||
| 6674 | ✗ | done = true; | |
| 6675 | ✗ | save_cheatkeys(); | |
| 6676 | ✗ | } | |
| 6677 | else | ||
| 6678 | { | ||
| 6679 | ✗ | box_start(1, "Duplicate Keys", get_zc_font(font_lfont), get_zc_font(font_sfont), false, 500,400, 2); | |
| 6680 | ✗ | box_out("Cannot have duplicate keybinds!"); box_eol(); | |
| 6681 | ✗ | for(std::vector<std::string>::iterator it = uniqueError.begin(); | |
| 6682 | ✗ | it != uniqueError.end(); ++it) | |
| 6683 | { | ||
| 6684 | ✗ | box_out((*it).c_str()); box_eol(); | |
| 6685 | ✗ | } | |
| 6686 | ✗ | box_end(true); | |
| 6687 | } | ||
| 6688 | ✗ | } | |
| 6689 | else // Cancel | ||
| 6690 | { | ||
| 6691 | ✗ | memcpy(cheatkeys, oldcheats, sizeof(cheatkeys)); | |
| 6692 | ✗ | done=true; | |
| 6693 | } | ||
| 6694 | ✗ | rest(1); | |
| 6695 | } | ||
| 6696 | |||
| 6697 | ✗ | return D_O_K; | |
| 6698 | ✗ | } | |
| 6699 | |||
| 6700 | ✗ | int32_t onSound() | |
| 6701 | { | ||
| 6702 | ✗ | if (get_qr(qr_OLD_SCRIPT_VOLUME)) | |
| 6703 | { | ||
| 6704 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_MIDI_VOLUME) | |
| 6705 | { | ||
| 6706 | ✗ | master_volume(-1, ((int32_t)FFCore.usr_midi_volume)); | |
| 6707 | ✗ | } | |
| 6708 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_DIGI_VOLUME) | |
| 6709 | { | ||
| 6710 | ✗ | master_volume((int32_t)(FFCore.usr_digi_volume), 1); | |
| 6711 | ✗ | } | |
| 6712 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_MUSIC_VOLUME) | |
| 6713 | { | ||
| 6714 | ✗ | emusic_volume = (int32_t)FFCore.usr_music_volume; | |
| 6715 | ✗ | } | |
| 6716 | ✗ | if (FFCore.coreflags & FFCORE_SCRIPTED_SFX_VOLUME) | |
| 6717 | { | ||
| 6718 | ✗ | sfx_volume = (int32_t)FFCore.usr_sfx_volume; | |
| 6719 | ✗ | } | |
| 6720 | ✗ | } | |
| 6721 | ✗ | if ( FFCore.coreflags&FFCORE_SCRIPTED_PANSTYLE ) | |
| 6722 | { | ||
| 6723 | ✗ | pan_style = (int32_t)FFCore.usr_panstyle; | |
| 6724 | ✗ | } | |
| 6725 | |||
| 6726 | ✗ | int32_t m = midi_volume; | |
| 6727 | ✗ | int32_t e = emusic_volume; | |
| 6728 | ✗ | int32_t s = sfx_volume; | |
| 6729 | ✗ | int32_t p = pan_style; | |
| 6730 | ✗ | pan_style = vbound(pan_style,0,3); | |
| 6731 | |||
| 6732 | ✗ | sound_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6733 | |||
| 6734 | ✗ | large_dialog(sound_dlg); | |
| 6735 | |||
| 6736 | ✗ | midi_dp[1] = sound_dlg[6].x; | |
| 6737 | ✗ | midi_dp[2] = sound_dlg[6].y; | |
| 6738 | ✗ | emus_dp[1] = sound_dlg[8].x; | |
| 6739 | ✗ | emus_dp[2] = sound_dlg[8].y; | |
| 6740 | ✗ | sfx_dp[1] = sound_dlg[10].x; | |
| 6741 | ✗ | sfx_dp[2] = sound_dlg[10].y; | |
| 6742 | ✗ | pan_dp[1] = sound_dlg[11].x; | |
| 6743 | ✗ | pan_dp[2] = sound_dlg[11].y; | |
| 6744 | ✗ | sound_dlg[15].d2 = (midi_volume==255) ? 32 : midi_volume>>3; | |
| 6745 | ✗ | sound_dlg[17].d2 = (emusic_volume==255) ? 32 : emusic_volume>>3; | |
| 6746 | ✗ | sound_dlg[19].d2 = (sfx_volume==255) ? 32 : sfx_volume>>3; | |
| 6747 | ✗ | sound_dlg[20].d2 = pan_style; | |
| 6748 | |||
| 6749 | ✗ | int32_t ret = do_zqdialog(sound_dlg,1); | |
| 6750 | |||
| 6751 | ✗ | if(ret==2) | |
| 6752 | { | ||
| 6753 | ✗ | master_volume(digi_volume,midi_volume); | |
| 6754 | ✗ | if (zcmusic) | |
| 6755 | ✗ | zcmusic_set_volume(zcmusic, emusic_volume); | |
| 6756 | |||
| 6757 | ✗ | int32_t temp_volume = sfx_volume; | |
| 6758 | ✗ | if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME)) | |
| 6759 | ✗ | temp_volume = (sfx_volume * FFCore.usr_sfx_volume) / 10000 / 100; | |
| 6760 | ✗ | for(int32_t i=0; i<WAV_COUNT; ++i) | |
| 6761 | { | ||
| 6762 | ✗ | if(sfx_voice[i] >= 0) | |
| 6763 | ✗ | voice_set_volume(sfx_voice[i], temp_volume); | |
| 6764 | ✗ | } | |
| 6765 | ✗ | zc_set_config(sfx_sect,"midi",midi_volume); | |
| 6766 | ✗ | zc_set_config(sfx_sect,"sfx",sfx_volume); | |
| 6767 | ✗ | zc_set_config(sfx_sect,"emusic",emusic_volume); | |
| 6768 | ✗ | zc_set_config(sfx_sect,"pan",pan_style); | |
| 6769 | ✗ | } | |
| 6770 | else | ||
| 6771 | { | ||
| 6772 | ✗ | midi_volume = m; | |
| 6773 | ✗ | emusic_volume = e; | |
| 6774 | ✗ | sfx_volume = s; | |
| 6775 | ✗ | pan_style = p; | |
| 6776 | } | ||
| 6777 | |||
| 6778 | ✗ | return D_O_K; | |
| 6779 | } | ||
| 6780 | |||
| 6781 | ✗ | int32_t queding(char const* s1, char const* s2, char const* s3) | |
| 6782 | { | ||
| 6783 | ✗ | return jwin_alert("ZQuest Classic",s1,s2,s3,"&Yes","&No",'y','n',get_zc_font(font_lfont)); | |
| 6784 | } | ||
| 6785 | |||
| 6786 | ✗ | int32_t onQuit() | |
| 6787 | { | ||
| 6788 | ✗ | if(Playing) | |
| 6789 | { | ||
| 6790 | ✗ | int32_t ret=0; | |
| 6791 | |||
| 6792 | ✗ | if(get_qr(qr_NOCONTINUE)) | |
| 6793 | { | ||
| 6794 | ✗ | if(standalone_mode) | |
| 6795 | { | ||
| 6796 | ✗ | ret=queding("End current game?", | |
| 6797 | "The continue screen is disabled; the game", | ||
| 6798 | "will be reloaded from the last save."); | ||
| 6799 | ✗ | } | |
| 6800 | else | ||
| 6801 | { | ||
| 6802 | ✗ | ret=queding("End current game?", | |
| 6803 | "The continue screen is disabled. You will", | ||
| 6804 | "be returned to the file select screen."); | ||
| 6805 | } | ||
| 6806 | ✗ | } | |
| 6807 | else | ||
| 6808 | ✗ | ret=queding("End current game?",NULL,NULL); | |
| 6809 | |||
| 6810 | ✗ | if(ret==1) | |
| 6811 | { | ||
| 6812 | ✗ | disableClickToFreeze=false; | |
| 6813 | ✗ | Quit=qQUIT; | |
| 6814 | |||
| 6815 | // Trying to evade a door repair charge? | ||
| 6816 | ✗ | if(repaircharge) | |
| 6817 | { | ||
| 6818 | ✗ | game->change_drupy(-repaircharge); | |
| 6819 | ✗ | repaircharge=0; | |
| 6820 | ✗ | } | |
| 6821 | |||
| 6822 | ✗ | return D_CLOSE; | |
| 6823 | } | ||
| 6824 | ✗ | } | |
| 6825 | |||
| 6826 | ✗ | return D_O_K; | |
| 6827 | ✗ | } | |
| 6828 | |||
| 6829 | ✗ | int32_t onTryQuitMenu() | |
| 6830 | { | ||
| 6831 | ✗ | return onTryQuit(true); | |
| 6832 | } | ||
| 6833 | |||
| 6834 | ✗ | int32_t onTryQuit(bool inMenu) | |
| 6835 | { | ||
| 6836 | ✗ | if(Playing && !(GameFlags & GAMEFLAG_NO_F6)) | |
| 6837 | { | ||
| 6838 | ✗ | if(active_cutscene.can_f6()) | |
| 6839 | { | ||
| 6840 | ✗ | if(get_qr(qr_OLD_F6)) | |
| 6841 | { | ||
| 6842 | ✗ | if(inMenu) onQuit(); | |
| 6843 | ✗ | else /*if(!get_qr(qr_NOCONTINUE))*/ f_Quit(qQUIT); | |
| 6844 | ✗ | } | |
| 6845 | else | ||
| 6846 | { | ||
| 6847 | ✗ | disableClickToFreeze=false; | |
| 6848 | ✗ | GameFlags |= GAMEFLAG_TRYQUIT; | |
| 6849 | } | ||
| 6850 | ✗ | return D_CLOSE; | |
| 6851 | } | ||
| 6852 | ✗ | else active_cutscene.error(); | |
| 6853 | ✗ | } | |
| 6854 | |||
| 6855 | ✗ | return D_O_K; | |
| 6856 | ✗ | } | |
| 6857 | |||
| 6858 | ✗ | int32_t onReset() | |
| 6859 | { | ||
| 6860 | ✗ | if(queding(" Reset system? ",NULL,NULL)==1) | |
| 6861 | { | ||
| 6862 | ✗ | disableClickToFreeze=false; | |
| 6863 | ✗ | Quit=qRESET; | |
| 6864 | ✗ | replay_quit(); | |
| 6865 | ✗ | return D_CLOSE; | |
| 6866 | } | ||
| 6867 | |||
| 6868 | ✗ | return D_O_K; | |
| 6869 | ✗ | } | |
| 6870 | |||
| 6871 | ✗ | int32_t onExit() | |
| 6872 | { | ||
| 6873 | ✗ | if(queding(" Quit ZQuest Classic? ",NULL,NULL)==1) | |
| 6874 | { | ||
| 6875 | ✗ | Quit=qEXIT; | |
| 6876 | ✗ | return D_CLOSE; | |
| 6877 | } | ||
| 6878 | |||
| 6879 | ✗ | return D_O_K; | |
| 6880 | ✗ | } | |
| 6881 | |||
| 6882 | ✗ | int32_t onDebug() | |
| 6883 | { | ||
| 6884 | ✗ | if(debug_enabled) | |
| 6885 | ✗ | set_debug(!get_debug()); | |
| 6886 | ✗ | return D_O_K; | |
| 6887 | } | ||
| 6888 | |||
| 6889 | ✗ | int32_t onHeartBeep() | |
| 6890 | { | ||
| 6891 | ✗ | heart_beep=!heart_beep; | |
| 6892 | ✗ | zc_set_config(cfg_sect,"heart_beep",heart_beep); | |
| 6893 | ✗ | return D_O_K; | |
| 6894 | } | ||
| 6895 | |||
| 6896 | ✗ | int32_t onSaveIndicator() | |
| 6897 | { | ||
| 6898 | ✗ | use_save_indicator = use_save_indicator ? 0 : 1; | |
| 6899 | ✗ | zc_set_config(cfg_sect,"save_indicator",use_save_indicator); | |
| 6900 | ✗ | return D_O_K; | |
| 6901 | } | ||
| 6902 | |||
| 6903 | ✗ | int32_t onEpilepsy() | |
| 6904 | { | ||
| 6905 | ✗ | if(jwin_alert3( | |
| 6906 | "Epilepsy Flash Reduction", | ||
| 6907 | "Enabling this will reduce the intensity of flashing and screen wave effects.", | ||
| 6908 | "Disabling this will restore standard flash and wavy behaviour.", | ||
| 6909 | "Proceed?", | ||
| 6910 | "&Yes", | ||
| 6911 | "&No", | ||
| 6912 | NULL, | ||
| 6913 | 'y', | ||
| 6914 | 'n', | ||
| 6915 | 0, | ||
| 6916 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 6917 | { | ||
| 6918 | ✗ | epilepsyFlashReduction = epilepsyFlashReduction ? 0 : 1; | |
| 6919 | ✗ | zc_set_config(cfg_sect,"epilepsy_flash_reduction",epilepsyFlashReduction); | |
| 6920 | ✗ | } | |
| 6921 | ✗ | return D_O_K; | |
| 6922 | } | ||
| 6923 | |||
| 6924 | bool rc = false; | ||
| 6925 | |||
| 6926 | static DIALOG getnum_dlg[] = | ||
| 6927 | { | ||
| 6928 | // (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) | ||
| 6929 | { jwin_win_proc, 80, 80, 160, 72, vc(0), vc(11), 0, D_EXIT, 0, 0, NULL, NULL, NULL }, | ||
| 6930 | { jwin_text_proc, 104, 104+4, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Number:", NULL, NULL }, | ||
| 6931 | { jwin_edit_proc, 168, 104, 48, 16, 0, 0, 0, 0, 6, 0, NULL, NULL, NULL }, | ||
| 6932 | { jwin_button_proc, 90, 126, 61, 21, vc(0), vc(11), 13, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | ||
| 6933 | { jwin_button_proc, 170, 126, 61, 21, vc(0), vc(11), 27, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | ||
| 6934 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | ||
| 6935 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | ||
| 6936 | }; | ||
| 6937 | |||
| 6938 | ✗ | int32_t getnumber(const char *prompt,int32_t initialval) | |
| 6939 | { | ||
| 6940 | char buf[20]; | ||
| 6941 | ✗ | sprintf(buf,"%d",initialval); | |
| 6942 | ✗ | getnum_dlg[0].dp=(void *)prompt; | |
| 6943 | ✗ | getnum_dlg[0].dp2=get_zc_font(font_lfont); | |
| 6944 | ✗ | getnum_dlg[2].dp=buf; | |
| 6945 | |||
| 6946 | ✗ | large_dialog(getnum_dlg); | |
| 6947 | |||
| 6948 | ✗ | if(do_zqdialog(getnum_dlg,2)==3) | |
| 6949 | ✗ | return atoi(buf); | |
| 6950 | |||
| 6951 | ✗ | return initialval; | |
| 6952 | ✗ | } | |
| 6953 | |||
| 6954 | ✗ | int32_t onLife() | |
| 6955 | { | ||
| 6956 | ✗ | int value = vbound(getnumber("Life",game->get_life()),1,game->get_maxlife()); | |
| 6957 | ✗ | cheats_enqueue(Cheat::Life, value); | |
| 6958 | ✗ | return D_O_K; | |
| 6959 | ✗ | } | |
| 6960 | |||
| 6961 | ✗ | int32_t onHeartC() | |
| 6962 | { | ||
| 6963 | ✗ | int max_life = vbound(getnumber("Heart Containers",game->get_maxlife()/game->get_hp_per_heart()),1,4095) * game->get_hp_per_heart(); | |
| 6964 | ✗ | int life = vbound(getnumber("Life",game->get_life()/game->get_hp_per_heart()),1,max_life/game->get_hp_per_heart())*game->get_hp_per_heart(); | |
| 6965 | ✗ | cheats_enqueue(Cheat::MaxLife, max_life); | |
| 6966 | ✗ | cheats_enqueue(Cheat::Life, life); | |
| 6967 | ✗ | return D_O_K; | |
| 6968 | ✗ | } | |
| 6969 | |||
| 6970 | ✗ | int32_t onMagicC() | |
| 6971 | { | ||
| 6972 | ✗ | int max_magic = vbound(getnumber("Magic Containers",game->get_maxmagic()/game->get_mp_per_block()),0,2047) * game->get_mp_per_block(); | |
| 6973 | ✗ | int magic = vbound(getnumber("Magic",game->get_magic()/game->get_mp_per_block()),0,max_magic/game->get_mp_per_block())*game->get_mp_per_block(); | |
| 6974 | ✗ | cheats_enqueue(Cheat::MaxMagic, max_magic); | |
| 6975 | ✗ | cheats_enqueue(Cheat::Magic, magic); | |
| 6976 | ✗ | return D_O_K; | |
| 6977 | ✗ | } | |
| 6978 | |||
| 6979 | ✗ | int32_t onRupies() | |
| 6980 | { | ||
| 6981 | ✗ | int value = vbound(getnumber("Rupees",game->get_rupies()),0,game->get_maxcounter(1)); | |
| 6982 | ✗ | cheats_enqueue(Cheat::Rupies, value); | |
| 6983 | ✗ | return D_O_K; | |
| 6984 | ✗ | } | |
| 6985 | |||
| 6986 | ✗ | int32_t onMaxBombs() | |
| 6987 | { | ||
| 6988 | ✗ | int value = vbound(getnumber("Max Bombs",game->get_maxbombs()),0,0xFFFF); | |
| 6989 | ✗ | cheats_enqueue(Cheat::MaxBombs, value); | |
| 6990 | ✗ | cheats_enqueue(Cheat::Bombs, value); | |
| 6991 | ✗ | return D_O_K; | |
| 6992 | ✗ | } | |
| 6993 | |||
| 6994 | ✗ | int32_t onRefillLife() | |
| 6995 | { | ||
| 6996 | ✗ | cheats_enqueue(Cheat::Life, game->get_maxlife()); | |
| 6997 | ✗ | return D_O_K; | |
| 6998 | ✗ | } | |
| 6999 | ✗ | int32_t onRefillMagic() | |
| 7000 | { | ||
| 7001 | ✗ | cheats_enqueue(Cheat::Magic, game->get_maxmagic()); | |
| 7002 | ✗ | return D_O_K; | |
| 7003 | ✗ | } | |
| 7004 | ✗ | int32_t onClock() | |
| 7005 | { | ||
| 7006 | ✗ | cheats_enqueue(Cheat::Clock); | |
| 7007 | ✗ | return D_O_K; | |
| 7008 | ✗ | } | |
| 7009 | |||
| 7010 | ✗ | int32_t onQstPath() | |
| 7011 | { | ||
| 7012 | char initial_path[2048]; | ||
| 7013 | ✗ | chop_path(qstdir); | |
| 7014 | ✗ | strcpy(initial_path, qstdir); | |
| 7015 | |||
| 7016 | ✗ | if (auto result = prompt_for_existing_folder("Quest File Directory", initial_path, "qst")) | |
| 7017 | { | ||
| 7018 | ✗ | char* path = result->data(); | |
| 7019 | ✗ | chop_path(path); | |
| 7020 | ✗ | fix_filename_case(path); | |
| 7021 | ✗ | fix_filename_slashes(path); | |
| 7022 | ✗ | strcpy(qstdir,path); | |
| 7023 | ✗ | strcpy(qstpath,qstdir); | |
| 7024 | ✗ | zc_set_config("zeldadx","quest_dir",qstdir); | |
| 7025 | ✗ | flush_config_file(); | |
| 7026 | ✗ | } | |
| 7027 | |||
| 7028 | ✗ | return D_O_K; | |
| 7029 | ✗ | } | |
| 7030 | |||
| 7031 | #include "dialog/cheat_dialog.h" | ||
| 7032 | ✗ | int32_t onCheat() | |
| 7033 | { | ||
| 7034 | ✗ | call_setcheat_dialog(); | |
| 7035 | ✗ | game->set_cheat(maxcheat); | |
| 7036 | ✗ | if(cheat) game->did_cheat(true); | |
| 7037 | ✗ | return D_O_K; | |
| 7038 | } | ||
| 7039 | |||
| 7040 | ✗ | int32_t onCheatRupies() | |
| 7041 | { | ||
| 7042 | ✗ | cheats_enqueue(Cheat::Rupies, game->get_maxcounter(1)); | |
| 7043 | ✗ | return D_O_K; | |
| 7044 | ✗ | } | |
| 7045 | |||
| 7046 | ✗ | int32_t onCheatArrows() | |
| 7047 | { | ||
| 7048 | ✗ | cheats_enqueue(Cheat::Arrows, game->get_maxarrows()); | |
| 7049 | ✗ | return D_O_K; | |
| 7050 | ✗ | } | |
| 7051 | |||
| 7052 | ✗ | int32_t onCheatBombs() | |
| 7053 | { | ||
| 7054 | ✗ | cheats_enqueue(Cheat::Bombs, game->get_maxbombs(), game->get_maxcounter(6)); | |
| 7055 | ✗ | return D_O_K; | |
| 7056 | ✗ | } | |
| 7057 | |||
| 7058 | // *** screen saver | ||
| 7059 | |||
| 7060 | 19229703 | int32_t after_time() | |
| 7061 | { | ||
| 7062 |
1/2✓ Branch 0 taken 19229703 times.
✗ Branch 1 not taken.
|
19229703 | if(ss_enable == 0) |
| 7063 | ✗ | return INT_MAX; | |
| 7064 | |||
| 7065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
|
19229703 | if(ss_after <= 0) |
| 7066 | ✗ | return 5 * 60; | |
| 7067 | |||
| 7068 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
|
19229703 | if(ss_after <= 3) |
| 7069 | ✗ | return ss_after * 15 * 60; | |
| 7070 | |||
| 7071 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19229703 times.
|
19229703 | if(ss_after <= 13) |
| 7072 | ✗ | return (ss_after - 3) * 60 * 60; | |
| 7073 | |||
| 7074 | 19229703 | return MAX_IDLE + 1; | |
| 7075 | 19229703 | } | |
| 7076 | |||
| 7077 | static const char *after_str[15] = | ||
| 7078 | { | ||
| 7079 | " 5 sec", "15 sec", "30 sec", "45 sec", " 1 min", " 2 min", " 3 min", | ||
| 7080 | " 4 min", " 5 min", " 6 min", " 7 min", " 8 min", " 9 min", "10 min", | ||
| 7081 | "Never" | ||
| 7082 | }; | ||
| 7083 | |||
| 7084 | ✗ | const char *after_list(int32_t index, int32_t *list_size) | |
| 7085 | { | ||
| 7086 | ✗ | if(index < 0) | |
| 7087 | { | ||
| 7088 | ✗ | *list_size = 15; | |
| 7089 | ✗ | return NULL; | |
| 7090 | } | ||
| 7091 | |||
| 7092 | ✗ | return after_str[index]; | |
| 7093 | ✗ | } | |
| 7094 | |||
| 7095 | 427 | static ListData after__list(after_list, &font); | |
| 7096 | |||
| 7097 | static DIALOG scrsaver_dlg[] = | ||
| 7098 | { | ||
| 7099 | /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ | ||
| 7100 | 427 | { jwin_win_proc, 32, 64, 256, 136, 0, 0, 0, D_EXIT, 0, 0, (void *) "Screen Saver Settings", NULL, NULL }, | |
| 7101 | 427 | { jwin_frame_proc, 42, 92, 236, 70, 0, 0, 0, 0, FR_ETCHED,0, NULL, NULL, NULL }, | |
| 7102 | 427 | { jwin_text_proc, 60, 104, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Run After", NULL, NULL }, | |
| 7103 | 427 | { jwin_text_proc, 60, 128, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Speed", NULL, NULL }, | |
| 7104 | 427 | { jwin_text_proc, 60, 144, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Density", NULL, NULL }, | |
| 7105 | 427 | { jwin_droplist_proc, 144, 100, 96, 16, 0, 0, 0, 0, 0, 0, (void *) &after__list, NULL, NULL }, | |
| 7106 | 427 | { jwin_slider_proc, 144, 128, 116, 8, vc(0), jwin_pal[jcBOX], 0, 0, 6, 0, NULL, NULL, NULL }, | |
| 7107 | 427 | { jwin_slider_proc, 144, 144, 116, 8, vc(0), jwin_pal[jcBOX], 0, 0, 6, 0, NULL, NULL, NULL }, | |
| 7108 | 427 | { jwin_button_proc, 42, 170, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "OK", NULL, NULL }, | |
| 7109 | 427 | { jwin_button_proc, 124, 170, 72, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Preview", NULL, NULL }, | |
| 7110 | 427 | { jwin_button_proc, 218, 170, 61, 21, 0, 0, 0, D_EXIT, 0, 0, (void *) "Cancel", NULL, NULL }, | |
| 7111 | 427 | { d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, | |
| 7112 | 427 | { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } | |
| 7113 | }; | ||
| 7114 | |||
| 7115 | ✗ | int32_t onScreenSaver() | |
| 7116 | { | ||
| 7117 | ✗ | scrsaver_dlg[0].dp2=get_zc_font(font_lfont); | |
| 7118 | int32_t oldcfgs[3]; | ||
| 7119 | ✗ | scrsaver_dlg[5].d1 = scrsaver_dlg[5].d2 = oldcfgs[0] = ss_after; | |
| 7120 | ✗ | scrsaver_dlg[6].d2 = oldcfgs[1] = ss_speed; | |
| 7121 | ✗ | scrsaver_dlg[7].d2 = oldcfgs[2] = ss_density; | |
| 7122 | |||
| 7123 | ✗ | large_dialog(scrsaver_dlg); | |
| 7124 | |||
| 7125 | ✗ | int32_t ret = do_zqdialog(scrsaver_dlg,-1); | |
| 7126 | |||
| 7127 | ✗ | if(ret == 8 || ret == 9) | |
| 7128 | { | ||
| 7129 | ✗ | ss_after = scrsaver_dlg[5].d1; | |
| 7130 | ✗ | ss_speed = scrsaver_dlg[6].d2; | |
| 7131 | ✗ | ss_density = scrsaver_dlg[7].d2; | |
| 7132 | ✗ | if(oldcfgs[0] != ss_after) | |
| 7133 | ✗ | zc_set_config(cfg_sect,"ss_after",ss_after); | |
| 7134 | ✗ | if(oldcfgs[1] != ss_speed) | |
| 7135 | ✗ | zc_set_config(cfg_sect,"ss_speed",ss_speed); | |
| 7136 | ✗ | if(oldcfgs[2] != ss_density) | |
| 7137 | ✗ | zc_set_config(cfg_sect,"ss_density",ss_density); | |
| 7138 | ✗ | } | |
| 7139 | |||
| 7140 | ✗ | if(ret == 9) | |
| 7141 | // preview Screen Saver | ||
| 7142 | { | ||
| 7143 | ✗ | clear_keybuf(); | |
| 7144 | ✗ | Matrix(ss_speed, ss_density, 30); | |
| 7145 | ✗ | system_pal(true); | |
| 7146 | ✗ | sys_mouse(); | |
| 7147 | ✗ | } | |
| 7148 | |||
| 7149 | ✗ | return D_O_K; | |
| 7150 | } | ||
| 7151 | |||
| 7152 | /***** Menus *****/ | ||
| 7153 | |||
| 7154 | enum | ||
| 7155 | { | ||
| 7156 | MENUID_GAME_LOADQUEST, | ||
| 7157 | MENUID_GAME_ENDGAME, | ||
| 7158 | }; | ||
| 7159 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu game_menu |
| 7160 | 3416 | { | |
| 7161 |
3/6✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
|
427 | { "&Continue","ESC", onContinue }, |
| 7162 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7163 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "L&oad Quest...", onCustomGame, MENUID_GAME_LOADQUEST }, |
| 7164 |
3/6✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
|
427 | { "&End Game","F6", onTryQuitMenu, MENUID_GAME_ENDGAME }, |
| 7165 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7166 | #ifdef __EMSCRIPTEN__ | ||
| 7167 | { "&Reset","F7", onReset }, | ||
| 7168 | #elif defined(ALLEGRO_MACOSX) | ||
| 7169 | { "&Reset","F7", onReset }, | ||
| 7170 | { "&Quit","F8", onExit }, | ||
| 7171 | #else | ||
| 7172 |
3/6✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
|
427 | { "&Reset","F9", onReset }, |
| 7173 |
3/6✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
|
427 | { "&Quit","F10", onExit }, |
| 7174 | #endif | ||
| 7175 | }; | ||
| 7176 | |||
| 7177 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu snapshot_format_menu |
| 7178 | 2989 | { | |
| 7179 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&BMP", std::bind(onSetSnapshotFormat, ssfmtBMP) }, |
| 7180 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&GIF", std::bind(onSetSnapshotFormat, ssfmtGIF) }, |
| 7181 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&JPG", std::bind(onSetSnapshotFormat, ssfmtJPG) }, |
| 7182 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&PNG", std::bind(onSetSnapshotFormat, ssfmtPNG) }, |
| 7183 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "PC&X", std::bind(onSetSnapshotFormat, ssfmtPCX) }, |
| 7184 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&TGA", std::bind(onSetSnapshotFormat, ssfmtTGA) }, |
| 7185 | }; | ||
| 7186 | |||
| 7187 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu bottom_8_pixels_menu |
| 7188 | 1708 | { | |
| 7189 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&Default (qst)", std::bind(onSetBottom8Pixels, 0) }, |
| 7190 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&On", std::bind(onSetBottom8Pixels, 1) }, |
| 7191 |
4/8✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
|
427 | { "&Off", std::bind(onSetBottom8Pixels, 2) }, |
| 7192 | }; | ||
| 7193 | |||
| 7194 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu controls_menu |
| 7195 | 1708 | { | |
| 7196 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Key&board...", onKeyboard }, |
| 7197 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Gamepad...", onGamepad }, |
| 7198 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Cheat Keys...", onCheatKeys }, |
| 7199 | }; | ||
| 7200 | |||
| 7201 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu name_entry_mode_menu |
| 7202 | 1708 | { | |
| 7203 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Keyboard", onKeyboardEntry }, |
| 7204 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Letter Grid", onLetterGridEntry }, |
| 7205 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Extended Letter Grid", onExtLetterGridEntry }, |
| 7206 | }; | ||
| 7207 | |||
| 7208 | static void set_controls_menu_active() | ||
| 7209 | { | ||
| 7210 | |||
| 7211 | } | ||
| 7212 | |||
| 7213 | enum | ||
| 7214 | { | ||
| 7215 | MENUID_WINDOW_LOCK_ASPECT, | ||
| 7216 | MENUID_WINDOW_LOCK_INTSCALE, | ||
| 7217 | MENUID_WINDOW_SAVE_SIZE, | ||
| 7218 | MENUID_WINDOW_SAVE_POS, | ||
| 7219 | MENUID_WINDOW_STRETCH, | ||
| 7220 | }; | ||
| 7221 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu window_menu |
| 7222 | 2562 | { | |
| 7223 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Lock Aspect Ratio", onDragAspect, MENUID_WINDOW_LOCK_ASPECT }, |
| 7224 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Lock Integer Scale", onIntegerScaling, MENUID_WINDOW_LOCK_INTSCALE }, |
| 7225 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Save Size Changes", onSaveDragResize, MENUID_WINDOW_SAVE_SIZE }, |
| 7226 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Save Position Changes", onWinPosSave, MENUID_WINDOW_SAVE_POS }, |
| 7227 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Stretch Game Area", onStretchGame, MENUID_WINDOW_STRETCH }, |
| 7228 | }; | ||
| 7229 | void call_zc_options_dlg(); | ||
| 7230 | enum | ||
| 7231 | { | ||
| 7232 | MENUID_OPTIONS_PAUSE_BG, | ||
| 7233 | MENUID_OPTIONS_EPILEPSYPROT, | ||
| 7234 | MENUID_OPTIONS_SHOWBOTTOMPIXELS, | ||
| 7235 | }; | ||
| 7236 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu options_menu |
| 7237 | 3416 | { | |
| 7238 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Name &Entry Mode", &name_entry_mode_menu }, |
| 7239 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "S&napshot Format", &snapshot_format_menu }, |
| 7240 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Window Settings", &window_menu }, |
| 7241 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Epilepsy Flash Reduction", onEpilepsy, MENUID_OPTIONS_EPILEPSYPROT }, |
| 7242 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Pause In Background", onPauseInBackground, MENUID_OPTIONS_PAUSE_BG }, |
| 7243 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Show Bottom 8 Pixels", &bottom_8_pixels_menu, MENUID_OPTIONS_SHOWBOTTOMPIXELS }, |
| 7244 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "More Options", call_zc_options_dlg }, |
| 7245 | }; | ||
| 7246 | enum | ||
| 7247 | { | ||
| 7248 | MENUID_SETTINGS_CONTROLS, | ||
| 7249 | MENUID_SETTINGS_CAPFPS, | ||
| 7250 | MENUID_SETTINGS_SHOWFPS, | ||
| 7251 | MENUID_SETTINGS_SHOWTIME, | ||
| 7252 | MENUID_SETTINGS_CLICK_FREEZE, | ||
| 7253 | MENUID_SETTINGS_TRANSLAYERS, | ||
| 7254 | MENUID_SETTINGS_NESQUIT, | ||
| 7255 | MENUID_SETTINGS_VOLKEYS, | ||
| 7256 | MENUID_SETTINGS_HEARTBEEP, | ||
| 7257 | MENUID_SETTINGS_SAVEINDICATOR, | ||
| 7258 | MENUID_SETTINGS_DEBUG, | ||
| 7259 | }; | ||
| 7260 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu settings_menu |
| 7261 | 7259 | { | |
| 7262 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Sound...", onSound }, |
| 7263 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "C&ontrols", &controls_menu, MENUID_SETTINGS_CONTROLS }, |
| 7264 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7265 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Options", &options_menu }, |
| 7266 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7267 |
3/6✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
|
427 | { "&Cap FPS","F1", onThrottleFPS, MENUID_SETTINGS_CAPFPS }, |
| 7268 |
3/6✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
|
427 | { "Show &FPS","F2", onShowFPS, MENUID_SETTINGS_SHOWFPS }, |
| 7269 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Show &Time", onShowTime, MENUID_SETTINGS_SHOWTIME }, |
| 7270 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Click to Freeze", onClickToFreeze, MENUID_SETTINGS_CLICK_FREEZE }, |
| 7271 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Cont. &Heart Beep", onHeartBeep, MENUID_SETTINGS_HEARTBEEP }, |
| 7272 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Show Trans. &Layers", onTransLayers, MENUID_SETTINGS_TRANSLAYERS }, |
| 7273 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Up+A+B To &Quit", onNESquit, MENUID_SETTINGS_NESQUIT }, |
| 7274 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Volume &Keys", onVolKeys, MENUID_SETTINGS_VOLKEYS }, |
| 7275 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Sa&ve Indicator", onSaveIndicator, MENUID_SETTINGS_SAVEINDICATOR }, |
| 7276 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7277 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Debu&g", onDebug, MENUID_SETTINGS_DEBUG }, |
| 7278 | }; | ||
| 7279 | |||
| 7280 | enum | ||
| 7281 | { | ||
| 7282 | MENUID_MISC_FULLSCREEN, | ||
| 7283 | MENUID_MISC_VIDMODE, | ||
| 7284 | MENUID_MISC_QUEST_INFO, | ||
| 7285 | MENUID_MISC_QUEST_DIR, | ||
| 7286 | MENUID_MISC_CONSOLE, | ||
| 7287 | MENUID_MISC_CLEAR_CONSOLE_ON_LOAD, | ||
| 7288 | }; | ||
| 7289 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu misc_menu |
| 7290 | 6405 | { | |
| 7291 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&About...", onAbout }, |
| 7292 | // TODO: re-enable, but: 1) do not use a bitmap thing that is hard to update 2) update names and 3) don't use the Z-word. | ||
| 7293 | // { "&Credits...", onCredits }, | ||
| 7294 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Fullscreen", onFullscreenMenu, MENUID_MISC_FULLSCREEN }, |
| 7295 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Video Mode...", onVidMode, MENUID_MISC_VIDMODE }, |
| 7296 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7297 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Quest Info...", onQuest, MENUID_MISC_QUEST_INFO }, |
| 7298 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Quest &MIDI Info...", onMIDICredits }, |
| 7299 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Quest &Directory...", onQstPath, MENUID_MISC_QUEST_DIR }, |
| 7300 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7301 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Take &Snapshot F12", onSnapshot }, |
| 7302 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Sc&reen Saver...", onScreenSaver }, |
| 7303 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Save ZC Configuration", OnSaveZCConfig }, |
| 7304 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Show Console", onConsole, MENUID_MISC_CONSOLE }, |
| 7305 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Clear Console on Qst Load", onClrConsoleOnLoad, MENUID_MISC_CLEAR_CONSOLE_ON_LOAD }, |
| 7306 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Clear Directory Cache", OnnClearQuestDir }, |
| 7307 | }; | ||
| 7308 | |||
| 7309 | enum | ||
| 7310 | { | ||
| 7311 | MENUID_REFILL_ARROWS, | ||
| 7312 | }; | ||
| 7313 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu refill_menu |
| 7314 | 2562 | { | |
| 7315 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Life", onRefillLife }, |
| 7316 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Magic", onRefillMagic }, |
| 7317 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Bombs", onCheatBombs }, |
| 7318 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Rupees", onCheatRupies }, |
| 7319 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Arrows", onCheatArrows, MENUID_REFILL_ARROWS }, |
| 7320 | }; | ||
| 7321 | |||
| 7322 | enum | ||
| 7323 | { | ||
| 7324 | MENUID_SHOW_L0, | ||
| 7325 | MENUID_SHOW_L1, | ||
| 7326 | MENUID_SHOW_L2, | ||
| 7327 | MENUID_SHOW_L3, | ||
| 7328 | MENUID_SHOW_L4, | ||
| 7329 | MENUID_SHOW_L5, | ||
| 7330 | MENUID_SHOW_L6, | ||
| 7331 | MENUID_SHOW_OVER, | ||
| 7332 | MENUID_SHOW_PUSH, | ||
| 7333 | MENUID_SHOW_FFC, | ||
| 7334 | MENUID_SHOW_SPR, | ||
| 7335 | MENUID_SHOW_SCRIPTNAME, | ||
| 7336 | MENUID_SHOW_SOLIDITY, | ||
| 7337 | MENUID_SHOW_HITBOX, | ||
| 7338 | MENUID_SHOW_EFFECT, | ||
| 7339 | }; | ||
| 7340 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu show_menu |
| 7341 | 8113 | { | |
| 7342 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Combos", onShowLayer0, MENUID_SHOW_L0 }, |
| 7343 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Layer 1", onShowLayer1, MENUID_SHOW_L1 }, |
| 7344 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Layer 2", onShowLayer2, MENUID_SHOW_L2 }, |
| 7345 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Layer 3", onShowLayer3, MENUID_SHOW_L3 }, |
| 7346 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Layer 4", onShowLayer4, MENUID_SHOW_L4 }, |
| 7347 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Layer 5", onShowLayer5, MENUID_SHOW_L5 }, |
| 7348 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Layer 6", onShowLayer6, MENUID_SHOW_L6 }, |
| 7349 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Overhead Combos", onShowLayerO, MENUID_SHOW_OVER }, |
| 7350 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Push Blocks", onShowLayerP, MENUID_SHOW_PUSH }, |
| 7351 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Freeform Combos", onShowLayerF, MENUID_SHOW_FFC }, |
| 7352 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Sprites", onShowLayerS, MENUID_SHOW_SPR }, |
| 7353 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7354 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Current FFC Scripts", onShowFFScripts, MENUID_SHOW_SCRIPTNAME }, |
| 7355 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | {}, |
| 7356 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Walkability", onShowLayerW, MENUID_SHOW_SOLIDITY }, |
| 7357 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Hitboxes", onShowHitboxes, MENUID_SHOW_HITBOX }, |
| 7358 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Effects", onShowLayerE, MENUID_SHOW_EFFECT }, |
| 7359 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Info Opacity", onShowInfoOpacity }, |
| 7360 | }; | ||
| 7361 | |||
| 7362 | enum | ||
| 7363 | { | ||
| 7364 | MENUID_CHEAT_CHOP_L1, | ||
| 7365 | MENUID_CHEAT_CHOP_L2, | ||
| 7366 | MENUID_CHEAT_CHOP_L3, | ||
| 7367 | MENUID_CHEAT_CHOP_L4, | ||
| 7368 | MENUID_CHEAT_INVULN, | ||
| 7369 | MENUID_CHEAT_NOCLIP, | ||
| 7370 | MENUID_CHEAT_IGNORESV, | ||
| 7371 | MENUID_CHEAT_GOFAST, | ||
| 7372 | }; | ||
| 7373 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | static NewMenu cheat_menu |
| 7374 | 7259 | { | |
| 7375 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Set &Cheat", onCheat }, |
| 7376 |
1/2✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
|
427 | { MENUID_CHEAT_CHOP_L1 }, |
| 7377 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Re&fill", &refill_menu }, |
| 7378 |
1/2✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
|
427 | { MENUID_CHEAT_CHOP_L2 }, |
| 7379 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Invincible", onClock, MENUID_CHEAT_INVULN }, |
| 7380 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Ma&x Bombs...", onMaxBombs }, |
| 7381 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Heart Containers...", onHeartC }, |
| 7382 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Magic Containers...", onMagicC }, |
| 7383 |
1/2✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
|
427 | { MENUID_CHEAT_CHOP_L3 }, |
| 7384 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Hero Data...", onCheatConsole }, |
| 7385 |
1/2✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
|
427 | { MENUID_CHEAT_CHOP_L4 }, |
| 7386 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Walk Through &Walls", onNoWalls, MENUID_CHEAT_NOCLIP }, |
| 7387 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Hero Ignores Side&view", onIgnoreSideview, MENUID_CHEAT_IGNORESV }, |
| 7388 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Quick Movement", onGoFast, MENUID_CHEAT_GOFAST }, |
| 7389 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Kill All Enemies", onKillCheat }, |
| 7390 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Trigger &Secrets", onSecretsCheat }, |
| 7391 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Trigger Secrets Perm", onSecretsCheatPerm }, |
| 7392 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Show/Hide Layer", &show_menu }, |
| 7393 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "Toggle &Light", onLightSwitch }, |
| 7394 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Goto Location...", onGoTo }, |
| 7395 | }; | ||
| 7396 | |||
| 7397 | #if DEVLEVEL > 0 | ||
| 7398 | int32_t devLogging(); | ||
| 7399 | int32_t devDebug(); | ||
| 7400 | int32_t devTimestmp(); | ||
| 7401 | #if DEVLEVEL > 1 | ||
| 7402 | int32_t setCheat(); | ||
| 7403 | #endif //DEVLEVEL > 1 | ||
| 7404 | enum | ||
| 7405 | { | ||
| 7406 | MENUID_DEV_LOGGING, | ||
| 7407 | MENUID_DEV_DEBUG, | ||
| 7408 | MENUID_DEV_TIMESTAMP, | ||
| 7409 | MENUID_DEV_SETCHEAT, | ||
| 7410 | }; | ||
| 7411 | static NewMenu dev_menu | ||
| 7412 | { | ||
| 7413 | { "&Force Error Log", devLogging, MENUID_DEV_LOGGING }, | ||
| 7414 | // { "&Extra Debug Log", devDebug, MENUID_DEV_DEBUG }, | ||
| 7415 | { "&Timestamp Log", devTimestmp, MENUID_DEV_TIMESTAMP }, | ||
| 7416 | #if DEVLEVEL > 1 | ||
| 7417 | {}, | ||
| 7418 | { "Set &Cheat", setCheat, MENUID_DEV_SETCHEAT }, | ||
| 7419 | #endif //DEVLEVEL > 1 | ||
| 7420 | }; | ||
| 7421 | int32_t devLogging() | ||
| 7422 | { | ||
| 7423 | dev_logging = !dev_logging; | ||
| 7424 | dev_menu.select_uid(MENUID_DEV_LOGGING, dev_logging); | ||
| 7425 | return D_O_K; | ||
| 7426 | } | ||
| 7427 | // int32_t devDebug() | ||
| 7428 | // { | ||
| 7429 | // dev_debug = !dev_debug; | ||
| 7430 | // dev_menu.select_uid(MENUID_DEV_DEBUG, dev_debug); | ||
| 7431 | // dev_menu[dv_dbg].flags = dev_debug ? D_SELECTED : 0; | ||
| 7432 | // return D_O_K; | ||
| 7433 | // } | ||
| 7434 | int32_t devTimestmp() | ||
| 7435 | { | ||
| 7436 | dev_timestmp = !dev_timestmp; | ||
| 7437 | dev_menu.select_uid(MENUID_DEV_TIMESTAMP, dev_timestmp); | ||
| 7438 | return D_O_K; | ||
| 7439 | } | ||
| 7440 | #if DEVLEVEL > 1 | ||
| 7441 | int32_t setCheat() | ||
| 7442 | { | ||
| 7443 | cheat = (vbound(getnumber("Cheat Level",cheat), 0, 4)); | ||
| 7444 | return D_O_K; | ||
| 7445 | } | ||
| 7446 | #endif //DEVLEVEL > 1 | ||
| 7447 | #endif //DEVLEVEL > 0 | ||
| 7448 | |||
| 7449 | enum | ||
| 7450 | { | ||
| 7451 | MENUID_PLAYER_CHEAT, | ||
| 7452 | }; | ||
| 7453 |
1/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
427 | TopMenu the_player_menu |
| 7454 | 2562 | { | |
| 7455 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Game", &game_menu }, |
| 7456 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Settings", &settings_menu }, |
| 7457 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Cheat", &cheat_menu, MENUID_PLAYER_CHEAT, true }, |
| 7458 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&Replay", &replay_menu }, |
| 7459 |
2/4✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
|
427 | { "&ZC", &misc_menu }, |
| 7460 | #if DEVLEVEL > 0 | ||
| 7461 | { "&Dev", &dev_menu }, | ||
| 7462 | #endif | ||
| 7463 | }; | ||
| 7464 | |||
| 7465 | ✗ | int32_t onPauseInBackground() | |
| 7466 | { | ||
| 7467 | ✗ | if(jwin_alert3( | |
| 7468 | "Toggle Pause In Background", | ||
| 7469 | "This action will change whether ZC Player pauses when the window loses focus.", | ||
| 7470 | "", | ||
| 7471 | "Proceed?", | ||
| 7472 | "&Yes", | ||
| 7473 | "&No", | ||
| 7474 | NULL, | ||
| 7475 | 'y', | ||
| 7476 | 'n', | ||
| 7477 | 0, | ||
| 7478 | ✗ | get_zc_font(font_lfont)) == 1) | |
| 7479 | { | ||
| 7480 | ✗ | pause_in_background = pause_in_background ? 0 : 1; | |
| 7481 | ✗ | zc_set_config("zeldadx","pause_in_background", pause_in_background); | |
| 7482 | ✗ | int switch_type = pause_in_background ? SWITCH_PAUSE : SWITCH_BACKGROUND; | |
| 7483 | ✗ | set_display_switch_mode(fullscreen?SWITCH_BACKAMNESIA:switch_type); | |
| 7484 | ✗ | set_display_switch_callback(SWITCH_OUT, switch_out_callback); | |
| 7485 | ✗ | set_display_switch_callback(SWITCH_IN, switch_in_callback); | |
| 7486 | ✗ | } | |
| 7487 | ✗ | options_menu.select_uid(MENUID_OPTIONS_PAUSE_BG, pause_in_background); | |
| 7488 | ✗ | return D_O_K; | |
| 7489 | } | ||
| 7490 | |||
| 7491 | ✗ | int32_t onKeyboardEntry() | |
| 7492 | { | ||
| 7493 | ✗ | NameEntryMode=0; | |
| 7494 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7495 | ✗ | return D_O_K; | |
| 7496 | } | ||
| 7497 | |||
| 7498 | ✗ | int32_t onLetterGridEntry() | |
| 7499 | { | ||
| 7500 | ✗ | NameEntryMode=1; | |
| 7501 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7502 | ✗ | return D_O_K; | |
| 7503 | } | ||
| 7504 | |||
| 7505 | ✗ | int32_t onExtLetterGridEntry() | |
| 7506 | { | ||
| 7507 | ✗ | NameEntryMode=2; | |
| 7508 | ✗ | zc_set_config(cfg_sect,"name_entry_mode",NameEntryMode); | |
| 7509 | ✗ | return D_O_K; | |
| 7510 | } | ||
| 7511 | |||
| 7512 | static BITMAP* oldscreen; | ||
| 7513 | ✗ | int32_t onFullscreenMenu() | |
| 7514 | { | ||
| 7515 | PALETTE oldpal; | ||
| 7516 | ✗ | get_palette(oldpal); | |
| 7517 | |||
| 7518 | ✗ | fullscreen = !fullscreen; | |
| 7519 | ✗ | all_toggle_fullscreen(fullscreen); | |
| 7520 | ✗ | zc_set_config("zeldadx","fullscreen",fullscreen); | |
| 7521 | |||
| 7522 | ✗ | zc_set_palette(oldpal); | |
| 7523 | ✗ | gui_mouse_focus=0; | |
| 7524 | extern int32_t switch_type; | ||
| 7525 | ✗ | switch_type = pause_in_background ? SWITCH_PAUSE : SWITCH_BACKGROUND; | |
| 7526 | ✗ | set_display_switch_mode(fullscreen?SWITCH_BACKAMNESIA:switch_type); | |
| 7527 | ✗ | set_display_switch_callback(SWITCH_OUT, switch_out_callback); | |
| 7528 | ✗ | set_display_switch_callback(SWITCH_IN, switch_in_callback); | |
| 7529 | ✗ | misc_menu.select_uid(MENUID_MISC_FULLSCREEN, isFullScreen()); | |
| 7530 | ✗ | misc_menu.select_uid(MENUID_MISC_VIDMODE, isFullScreen()); | |
| 7531 | |||
| 7532 | ✗ | return D_O_K; | |
| 7533 | } | ||
| 7534 | |||
| 7535 | 323 | void fix_menu() | |
| 7536 | { | ||
| 7537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 323 times.
|
323 | if(!debug_enabled) |
| 7538 | 323 | settings_menu.chop_index = 13; | |
| 7539 | 323 | } | |
| 7540 | |||
| 7541 | ✗ | int32_t onSetSnapshotFormat(SnapshotType format) | |
| 7542 | { | ||
| 7543 | ✗ | SnapshotFormat = format; | |
| 7544 | ✗ | zc_set_config("zeldadx", "snapshot_format", format); | |
| 7545 | ✗ | snapshot_format_menu.select_only_index(format); | |
| 7546 | ✗ | return D_O_K; | |
| 7547 | } | ||
| 7548 | |||
| 7549 | ✗ | int32_t onSetBottom8Pixels(int option) | |
| 7550 | { | ||
| 7551 | ✗ | ShowBottomPixels = option; | |
| 7552 | ✗ | zc_set_config("zeldadx", "bottom_8_px", option); | |
| 7553 | ✗ | bottom_8_pixels_menu.select_only_index(option); | |
| 7554 | |||
| 7555 | ✗ | int qr = qr_HIDE_BOTTOM_8_PIXELS; | |
| 7556 | ✗ | bool value = false; | |
| 7557 | ✗ | if (option == 0) | |
| 7558 | ✗ | value = get_bit(quest_rules, qr) != 0; // This is the original value, as set in the qst file (or via scripting). | |
| 7559 | ✗ | else if (option == 1) | |
| 7560 | ✗ | value = false; | |
| 7561 | ✗ | else if (option == 2) | |
| 7562 | ✗ | value = true; | |
| 7563 | ✗ | enqueue_qr_change(qr, value); | |
| 7564 | |||
| 7565 | ✗ | return D_O_K; | |
| 7566 | } | ||
| 7567 | |||
| 7568 | 3018 | void updateShowBottomPixels() | |
| 7569 | { | ||
| 7570 | // It's too tricky the allow modifying the screen height between opening and closing the | ||
| 7571 | // active subscreen. | ||
| 7572 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 2992 times.
|
3018 | if (subscreen_open) |
| 7573 | 26 | return; | |
| 7574 | |||
| 7575 |
1/2✓ Branch 0 taken 2992 times.
✗ Branch 1 not taken.
|
2992 | if (!GameLoaded) |
| 7576 | ✗ | show_bottom_8px = false; | |
| 7577 | else | ||
| 7578 | 2992 | show_bottom_8px = !get_qr(qr_HIDE_BOTTOM_8_PIXELS); | |
| 7579 | |||
| 7580 | 2992 | int target_bitmap_height = show_bottom_8px ? 232 : 224; | |
| 7581 |
2/2✓ Branch 0 taken 2878 times.
✓ Branch 1 taken 114 times.
|
2992 | if (framebuf->h != target_bitmap_height) |
| 7582 | { | ||
| 7583 | 114 | BITMAP* new_framebuf = create_bitmap_ex(8, 256, target_bitmap_height); | |
| 7584 | 114 | clear_bitmap(new_framebuf); | |
| 7585 | 114 | blit(framebuf, new_framebuf, 0, 0, 0, 0, new_framebuf->w, new_framebuf->h); | |
| 7586 | |||
| 7587 | 114 | BITMAP* new_framebuf_active_subscreen = create_bitmap_ex(8, 256, target_bitmap_height); | |
| 7588 | 114 | clear_bitmap(new_framebuf_active_subscreen); | |
| 7589 |
1/2✓ Branch 0 taken 114 times.
✗ Branch 1 not taken.
|
114 | if (framebuf_no_passive_subscreen) |
| 7590 | 114 | blit(framebuf_no_passive_subscreen, new_framebuf_active_subscreen, 0, 0, 0, 0, new_framebuf_active_subscreen->w, new_framebuf_active_subscreen->h); | |
| 7591 | |||
| 7592 | 114 | destroy_bitmap(framebuf); | |
| 7593 | 114 | destroy_bitmap(framebuf_no_passive_subscreen); | |
| 7594 | 114 | destroy_bitmap(script_menu_buf); | |
| 7595 | 114 | destroy_bitmap(f6_menu_buf); | |
| 7596 | 114 | destroy_bitmap(darkscr_bmp); | |
| 7597 | 114 | destroy_bitmap(darkscr_bmp_trans); | |
| 7598 | |||
| 7599 | 114 | framebuf = new_framebuf; | |
| 7600 | 114 | framebuf_no_passive_subscreen = new_framebuf_active_subscreen; | |
| 7601 | 114 | script_menu_buf = create_bitmap_ex(8, 256, target_bitmap_height); | |
| 7602 | 114 | f6_menu_buf = create_bitmap_ex(8, 256, target_bitmap_height); | |
| 7603 | 114 | darkscr_bmp = create_bitmap_ex(8, 256, target_bitmap_height); | |
| 7604 | 114 | darkscr_bmp_trans = create_bitmap_ex(8, 256, target_bitmap_height); | |
| 7605 | |||
| 7606 | 114 | rti_game.a4_bitmap = framebuf; | |
| 7607 | 114 | rti_game.set_size(framebuf->w, framebuf->h); | |
| 7608 | 114 | al_set_new_bitmap_flags(ALLEGRO_CONVERT_BITMAP); | |
| 7609 | 114 | al_destroy_bitmap(rti_game.bitmap); | |
| 7610 | 114 | rti_game.bitmap = create_a5_bitmap(framebuf->w, framebuf->h); | |
| 7611 | 114 | al_destroy_bitmap(rti_infolayer.bitmap); | |
| 7612 | 114 | rti_infolayer.bitmap = create_a5_bitmap(framebuf->w, framebuf->h); | |
| 7613 | 114 | rti_infolayer.set_size(framebuf->w, framebuf->h); | |
| 7614 | 114 | } | |
| 7615 | 3018 | } | |
| 7616 | |||
| 7617 | ✗ | void color_layer(RGB *src,RGB *dest,char r,char g,char b,char pos,int32_t from,int32_t to) | |
| 7618 | { | ||
| 7619 | PALETTE tmp; | ||
| 7620 | |||
| 7621 | ✗ | for(int32_t i=0; i<256; i++) | |
| 7622 | { | ||
| 7623 | ✗ | tmp[i].r=r; | |
| 7624 | ✗ | tmp[i].g=g; | |
| 7625 | ✗ | tmp[i].b=b; | |
| 7626 | ✗ | } | |
| 7627 | |||
| 7628 | ✗ | fade_interpolate(src,tmp,dest,pos,from,to); | |
| 7629 | ✗ | } | |
| 7630 | |||
| 7631 | 59 | void system_pal(bool force) | |
| 7632 | { | ||
| 7633 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
59 | if(is_sys_pal && !force) return; |
| 7634 | 59 | is_sys_pal = true; | |
| 7635 | 59 | load_colorset(gui_colorset, syspal, jwin_a5_colors); | |
| 7636 | 59 | hw_palette = &syspal; | |
| 7637 | 59 | update_hw_pal = true; | |
| 7638 | 59 | } | |
| 7639 | |||
| 7640 | static uint32_t entered_sys_pal = 0; | ||
| 7641 | 59 | void enter_sys_pal() | |
| 7642 | { | ||
| 7643 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(is_sys_pal) |
| 7644 | { | ||
| 7645 | ✗ | if(entered_sys_pal) | |
| 7646 | ✗ | ++entered_sys_pal; | |
| 7647 | ✗ | return; | |
| 7648 | } | ||
| 7649 | 59 | sys_mouse(); | |
| 7650 | 59 | system_pal(true); | |
| 7651 | 59 | ++entered_sys_pal; | |
| 7652 | 59 | } | |
| 7653 | 59 | void exit_sys_pal() | |
| 7654 | { | ||
| 7655 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(entered_sys_pal) |
| 7656 | { | ||
| 7657 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!--entered_sys_pal) |
| 7658 | { | ||
| 7659 | 59 | game_pal(); | |
| 7660 | 59 | game_mouse(); | |
| 7661 | 59 | } | |
| 7662 | 59 | } | |
| 7663 | 59 | } | |
| 7664 | |||
| 7665 | ✗ | void switch_out_callback() | |
| 7666 | { | ||
| 7667 | ✗ | if (pause_in_background && !MenuOpen) | |
| 7668 | { | ||
| 7669 | ✗ | System(); | |
| 7670 | ✗ | } | |
| 7671 | ✗ | } | |
| 7672 | |||
| 7673 | ✗ | void switch_in_callback() | |
| 7674 | { | ||
| 7675 | ✗ | } | |
| 7676 | |||
| 7677 | 1204 | void game_pal() | |
| 7678 | { | ||
| 7679 | 1204 | is_sys_pal = false; | |
| 7680 | 1204 | entered_sys_pal = 0; | |
| 7681 | 1204 | hw_palette = &RAMpal; | |
| 7682 | 1204 | update_hw_pal = true; | |
| 7683 | 1204 | } | |
| 7684 | |||
| 7685 | static char bar_str[] = ""; | ||
| 7686 | |||
| 7687 | 59 | void music_pause() | |
| 7688 | { | ||
| 7689 | //al_pause_duh(tmplayer); | ||
| 7690 | 59 | zcmusic_pause(zcmusic, ZCM_PAUSE); | |
| 7691 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(zcmixer->oldtrack) |
| 7692 | ✗ | zcmusic_pause(zcmixer->oldtrack, ZCM_PAUSE); | |
| 7693 | 59 | zc_midi_pause(); | |
| 7694 | 59 | } | |
| 7695 | |||
| 7696 | ✗ | void music_resume() | |
| 7697 | { | ||
| 7698 | //al_resume_duh(tmplayer); | ||
| 7699 | ✗ | zcmusic_pause(zcmusic, ZCM_RESUME); | |
| 7700 | ✗ | if (zcmixer->oldtrack) | |
| 7701 | ✗ | zcmusic_pause(zcmixer->oldtrack, ZCM_RESUME); | |
| 7702 | ✗ | zc_midi_resume(); | |
| 7703 | ✗ | } | |
| 7704 | |||
| 7705 | 8354 | void music_stop() | |
| 7706 | { | ||
| 7707 | //al_stop_duh(tmplayer); | ||
| 7708 | //unload_duh(tmusic); | ||
| 7709 | //tmusic=NULL; | ||
| 7710 | //tmplayer=NULL; | ||
| 7711 | 8354 | zcmusic_stop(zcmusic); | |
| 7712 | 8354 | zcmusic_unload_file(zcmusic); | |
| 7713 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8354 times.
|
8354 | if (zcmixer->oldtrack) |
| 7714 | { | ||
| 7715 | ✗ | zcmusic_stop(zcmixer->oldtrack); | |
| 7716 | ✗ | zcmusic_unload_file(zcmixer->oldtrack); | |
| 7717 | ✗ | } | |
| 7718 | 8354 | zcmixer->newtrack = NULL; | |
| 7719 | 8354 | zc_stop_midi(); | |
| 7720 | 8354 | currmidi=-1; | |
| 7721 | 8354 | } | |
| 7722 | |||
| 7723 | bool reload_fonts = false; | ||
| 7724 | ✗ | void System() | |
| 7725 | { | ||
| 7726 | ✗ | mouse_down = gui_mouse_b(); | |
| 7727 | ✗ | music_pause(); | |
| 7728 | ✗ | pause_all_sfx(); | |
| 7729 | ✗ | MenuOpen = true; | |
| 7730 | ✗ | enter_sys_pal(); | |
| 7731 | // FONT *oldfont=font; | ||
| 7732 | // font=tfont; | ||
| 7733 | |||
| 7734 | ✗ | misc_menu.select_uid(MENUID_MISC_FULLSCREEN, isFullScreen()); | |
| 7735 | ✗ | misc_menu.disable_uid(MENUID_MISC_VIDMODE, isFullScreen()); | |
| 7736 | |||
| 7737 | #if DEVLEVEL > 1 | ||
| 7738 | dev_menu.disable_uid(MENUID_DEV_SETCHEAT, !Playing); | ||
| 7739 | #endif | ||
| 7740 | ✗ | game_menu.disable_uid(MENUID_GAME_LOADQUEST, get_unset_save_slot()); | |
| 7741 | ✗ | game_menu.disable_uid(MENUID_GAME_ENDGAME, !Playing); | |
| 7742 | ✗ | misc_menu.disable_uid(MENUID_MISC_QUEST_INFO, !Playing); | |
| 7743 | ✗ | misc_menu.disable_uid(MENUID_MISC_QUEST_DIR, Playing); | |
| 7744 | ✗ | clear_keybuf(); | |
| 7745 | |||
| 7746 | ✗ | clear_bitmap(menu_bmp); | |
| 7747 | ✗ | oldscreen = screen; | |
| 7748 | ✗ | screen = menu_bmp; | |
| 7749 | |||
| 7750 | ✗ | the_player_menu.reset_state(); | |
| 7751 | ✗ | the_player_menu.position(0, 0); | |
| 7752 | |||
| 7753 | ✗ | bool running = true; | |
| 7754 | ✗ | bool esc = key[KEY_ESC] || cMbtn(); | |
| 7755 | ✗ | bool autopop = esc; | |
| 7756 | ✗ | do | |
| 7757 | { | ||
| 7758 | ✗ | if(reload_fonts) | |
| 7759 | { | ||
| 7760 | ✗ | init_custom_fonts(); | |
| 7761 | ✗ | clear_bitmap(menu_bmp); | |
| 7762 | ✗ | broadcast_dialog_message(MSG_DRAW, 0); | |
| 7763 | ✗ | reload_fonts = false; | |
| 7764 | ✗ | } | |
| 7765 | ✗ | if(handle_close_btn_quit()) | |
| 7766 | ✗ | break; | |
| 7767 | |||
| 7768 | //update submenus | ||
| 7769 | { | ||
| 7770 | ✗ | settings_menu.disable_uid(MENUID_SETTINGS_CONTROLS, replay_is_replaying()); | |
| 7771 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_CAPFPS, Throttlefps); | |
| 7772 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_SHOWFPS, ShowFPS); | |
| 7773 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_SHOWTIME, ShowGameTime); | |
| 7774 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_CLICK_FREEZE, ClickToFreeze); | |
| 7775 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_TRANSLAYERS, TransLayers); | |
| 7776 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_NESQUIT, NESquit); | |
| 7777 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_VOLKEYS, volkeys); | |
| 7778 | |||
| 7779 | ✗ | window_menu.select_uid(MENUID_WINDOW_LOCK_ASPECT, DragAspect); | |
| 7780 | ✗ | window_menu.select_uid(MENUID_WINDOW_LOCK_INTSCALE, scaleForceInteger); | |
| 7781 | ✗ | window_menu.select_uid(MENUID_WINDOW_SAVE_SIZE, SaveDragResize); | |
| 7782 | ✗ | window_menu.select_uid(MENUID_WINDOW_SAVE_POS, SaveWinPos); | |
| 7783 | ✗ | window_menu.select_uid(MENUID_WINDOW_STRETCH, stretchGame); | |
| 7784 | |||
| 7785 | ✗ | options_menu.select_uid(MENUID_OPTIONS_EPILEPSYPROT, epilepsyFlashReduction); | |
| 7786 | ✗ | options_menu.select_uid(MENUID_OPTIONS_PAUSE_BG, pause_in_background); | |
| 7787 | ✗ | options_menu.disable_uid(MENUID_OPTIONS_SHOWBOTTOMPIXELS, replay_is_replaying()); | |
| 7788 | |||
| 7789 | ✗ | name_entry_mode_menu.select_only_index(NameEntryMode); | |
| 7790 | |||
| 7791 | ✗ | misc_menu.select_uid(MENUID_MISC_CONSOLE, console_enabled); | |
| 7792 | ✗ | misc_menu.select_uid(MENUID_MISC_CLEAR_CONSOLE_ON_LOAD, clearConsoleOnLoad); | |
| 7793 | |||
| 7794 | ✗ | bool nocheat = (replay_is_replaying() || !Playing | |
| 7795 | ✗ | || (!maxcheat && !zcheats.flags && !get_debug() && DEVLEVEL < 2 && !zqtesting_mode && !devpwd())); | |
| 7796 | ✗ | the_player_menu.disable_uid(MENUID_PLAYER_CHEAT, nocheat); | |
| 7797 | ✗ | refill_menu.disable_uid(MENUID_REFILL_ARROWS, !get_qr(qr_TRUEARROWS)); | |
| 7798 | ✗ | cheat_menu.chop_index.reset(); | |
| 7799 | ✗ | if(cheat < 4) | |
| 7800 | ✗ | cheat_menu.chop_index = cheat_menu.ind_at(MENUID_CHEAT_CHOP_L1+cheat); | |
| 7801 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_INVULN, getClock()); | |
| 7802 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_NOCLIP, walk_through_walls); | |
| 7803 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_IGNORESV, ignoreSideview); | |
| 7804 | ✗ | cheat_menu.select_uid(MENUID_CHEAT_GOFAST, gofast); | |
| 7805 | |||
| 7806 | ✗ | show_menu.select_uid(MENUID_SHOW_L0, show_layers[0]); | |
| 7807 | ✗ | show_menu.select_uid(MENUID_SHOW_L1, show_layers[1]); | |
| 7808 | ✗ | show_menu.select_uid(MENUID_SHOW_L2, show_layers[2]); | |
| 7809 | ✗ | show_menu.select_uid(MENUID_SHOW_L3, show_layers[3]); | |
| 7810 | ✗ | show_menu.select_uid(MENUID_SHOW_L4, show_layers[4]); | |
| 7811 | ✗ | show_menu.select_uid(MENUID_SHOW_L5, show_layers[5]); | |
| 7812 | ✗ | show_menu.select_uid(MENUID_SHOW_L6, show_layers[6]); | |
| 7813 | ✗ | show_menu.select_uid(MENUID_SHOW_OVER, show_layer_over); | |
| 7814 | ✗ | show_menu.select_uid(MENUID_SHOW_PUSH, show_layer_push); | |
| 7815 | ✗ | show_menu.select_uid(MENUID_SHOW_SPR, show_sprites); | |
| 7816 | ✗ | show_menu.select_uid(MENUID_SHOW_FFC, show_ffcs); | |
| 7817 | ✗ | show_menu.select_uid(MENUID_SHOW_SOLIDITY, show_walkflags); | |
| 7818 | ✗ | show_menu.select_uid(MENUID_SHOW_SCRIPTNAME, show_ff_scripts); | |
| 7819 | ✗ | show_menu.select_uid(MENUID_SHOW_HITBOX, show_hitboxes); | |
| 7820 | ✗ | show_menu.select_uid(MENUID_SHOW_EFFECT, show_effectflags); | |
| 7821 | |||
| 7822 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_HEARTBEEP, heart_beep); | |
| 7823 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_SAVEINDICATOR, use_save_indicator); | |
| 7824 | |||
| 7825 | ✗ | replay_menu.by_uid(MENUID_REPLAY_STOP)->text = fmt::format("Stop {}", | |
| 7826 | ✗ | replay_get_mode() == ReplayMode::Record ? "recording" : "replaying"); | |
| 7827 | |||
| 7828 | ✗ | replay_menu.select_uid(MENUID_REPLAY_RECORDNEW, zc_get_config("zeldadx", "replay_new_saves", false)); | |
| 7829 | #ifdef HAS_CURL | ||
| 7830 | ✗ | replay_menu.select_uid(MENUID_REPLAY_AUTOUPLOAD, replay_upload_auto_enabled()); | |
| 7831 | #endif | ||
| 7832 | ✗ | replay_menu.disable_uid(MENUID_REPLAY_STOP, !replay_is_active()); | |
| 7833 | ✗ | replay_menu.disable_uid(MENUID_REPLAY_SAVE, replay_get_mode() != ReplayMode::Record); | |
| 7834 | ✗ | replay_menu.select_uid(MENUID_REPLAY_SNAP_ALL, replay_is_snapshot_all_frames()); | |
| 7835 | |||
| 7836 | ✗ | snapshot_format_menu.select_only_index(SnapshotFormat); | |
| 7837 | ✗ | bottom_8_pixels_menu.select_only_index(ShowBottomPixels); | |
| 7838 | } | ||
| 7839 | |||
| 7840 | ✗ | if(debug_enabled) | |
| 7841 | ✗ | settings_menu.select_uid(MENUID_SETTINGS_DEBUG, get_debug()); | |
| 7842 | |||
| 7843 | ✗ | if(autopop) | |
| 7844 | ✗ | clear_keybuf(); | |
| 7845 | ✗ | the_player_menu.run(true); | |
| 7846 | ✗ | if(autopop) | |
| 7847 | { | ||
| 7848 | ✗ | the_player_menu.pop_sub(0, &the_player_menu); | |
| 7849 | ✗ | the_player_menu.draw(screen, the_player_menu.hovered_ind()); | |
| 7850 | ✗ | autopop = false; | |
| 7851 | ✗ | update_hw_screen(); | |
| 7852 | ✗ | } | |
| 7853 | |||
| 7854 | ✗ | update_hw_screen(); | |
| 7855 | |||
| 7856 | ✗ | auto mb = gui_mouse_b(); | |
| 7857 | ✗ | if(XOR(mb, mouse_down)) | |
| 7858 | { | ||
| 7859 | ✗ | if(!the_player_menu.has_mouse()) | |
| 7860 | ✗ | if(mb) | |
| 7861 | ✗ | break; | |
| 7862 | ✗ | mouse_down = mb; | |
| 7863 | ✗ | } | |
| 7864 | |||
| 7865 | ✗ | if(input_idle(true) > after_time()) | |
| 7866 | // run Screeen Saver | ||
| 7867 | { | ||
| 7868 | // Screen saver enabled for now. | ||
| 7869 | ✗ | clear_keybuf(); | |
| 7870 | ✗ | Matrix(ss_speed, ss_density, 0); | |
| 7871 | ✗ | system_pal(true); | |
| 7872 | ✗ | sys_mouse(); | |
| 7873 | ✗ | } | |
| 7874 | |||
| 7875 | ✗ | poll_keyboard(); | |
| 7876 | ✗ | if(esc) | |
| 7877 | { | ||
| 7878 | ✗ | if(!key[KEY_ESC]) | |
| 7879 | ✗ | esc = false; | |
| 7880 | ✗ | } | |
| 7881 | |||
| 7882 | ✗ | if(keypressed() && !CHECK_ALT) //System hotkeys | |
| 7883 | { | ||
| 7884 | ✗ | auto c = peekkey(); | |
| 7885 | ✗ | bool eatkey = true; | |
| 7886 | ✗ | switch(c>>8) | |
| 7887 | { | ||
| 7888 | //Spare keys used by the menu | ||
| 7889 | case KEY_UP: | ||
| 7890 | case KEY_DOWN: | ||
| 7891 | case KEY_LEFT: | ||
| 7892 | case KEY_RIGHT: | ||
| 7893 | ✗ | eatkey = false; | |
| 7894 | ✗ | break; | |
| 7895 | case KEY_F1: | ||
| 7896 | ✗ | onThrottleFPS(); | |
| 7897 | ✗ | break; | |
| 7898 | case KEY_F2: | ||
| 7899 | ✗ | onShowFPS(); | |
| 7900 | ✗ | break; | |
| 7901 | case KEY_F6: | ||
| 7902 | ✗ | onTryQuitMenu(); | |
| 7903 | ✗ | break; | |
| 7904 | #ifndef ALLEGRO_MACOSX | ||
| 7905 | case KEY_F9: | ||
| 7906 | ✗ | onReset(); | |
| 7907 | ✗ | break; | |
| 7908 | case KEY_F10: | ||
| 7909 | ✗ | onExit(); | |
| 7910 | ✗ | break; | |
| 7911 | #else | ||
| 7912 | case KEY_F7: | ||
| 7913 | onReset(); | ||
| 7914 | break; | ||
| 7915 | case KEY_F8: | ||
| 7916 | onExit(); | ||
| 7917 | break; | ||
| 7918 | #endif | ||
| 7919 | case KEY_F12: | ||
| 7920 | ✗ | onSnapshot(); | |
| 7921 | ✗ | break; | |
| 7922 | case KEY_TAB: | ||
| 7923 | ✗ | onDebug(); | |
| 7924 | ✗ | break; | |
| 7925 | case KEY_ESC: | ||
| 7926 | ✗ | if(!esc) | |
| 7927 | ✗ | running = false; | |
| 7928 | ✗ | break; | |
| 7929 | } | ||
| 7930 | ✗ | if(eatkey) | |
| 7931 | ✗ | readkey(); | |
| 7932 | ✗ | } | |
| 7933 | ✗ | if(Quit || (GameFlags & GAMEFLAG_TRYQUIT)) | |
| 7934 | ✗ | break; | |
| 7935 | ✗ | } | |
| 7936 | ✗ | while(running); | |
| 7937 | |||
| 7938 | ✗ | screen = oldscreen; | |
| 7939 | |||
| 7940 | ✗ | mouse_down=gui_mouse_b(); | |
| 7941 | ✗ | MenuOpen = false; | |
| 7942 | ✗ | if(Quit) | |
| 7943 | { | ||
| 7944 | ✗ | kill_sfx(); | |
| 7945 | ✗ | music_stop(); | |
| 7946 | ✗ | update_hw_screen(); | |
| 7947 | ✗ | } | |
| 7948 | else | ||
| 7949 | { | ||
| 7950 | ✗ | music_resume(); | |
| 7951 | ✗ | resume_all_sfx(); | |
| 7952 | |||
| 7953 | ✗ | if(rc) | |
| 7954 | ✗ | ringcolor(false); | |
| 7955 | } | ||
| 7956 | ✗ | exit_sys_pal(); | |
| 7957 | |||
| 7958 | ✗ | eat_buttons(); | |
| 7959 | |||
| 7960 | ✗ | rc=false; | |
| 7961 | ✗ | clear_keybuf(); | |
| 7962 | |||
| 7963 | ✗ | zc_init_apply_cheat_delta(); | |
| 7964 | ✗ | } | |
| 7965 | |||
| 7966 | 323 | void fix_dialogs() | |
| 7967 | { | ||
| 7968 | 323 | jwin_center_dialog(about_dlg); | |
| 7969 | 323 | jwin_center_dialog(gamepad_dlg); | |
| 7970 | 323 | jwin_center_dialog(credits_dlg); | |
| 7971 | 323 | jwin_center_dialog(gamemode_dlg); | |
| 7972 | 323 | jwin_center_dialog(getnum_dlg); | |
| 7973 | 323 | jwin_center_dialog(goto_dlg); | |
| 7974 | 323 | jwin_center_dialog(keyboard_control_dlg); | |
| 7975 | 323 | jwin_center_dialog(midi_dlg); | |
| 7976 | 323 | jwin_center_dialog(quest_dlg); | |
| 7977 | 323 | jwin_center_dialog(scrsaver_dlg); | |
| 7978 | 323 | jwin_center_dialog(sound_dlg); | |
| 7979 | 323 | jwin_center_dialog(triforce_dlg); | |
| 7980 | 323 | } | |
| 7981 | |||
| 7982 | 4339 | INLINE int32_t mixvol(int32_t v1,int32_t v2) | |
| 7983 | { | ||
| 7984 |
3/4✓ Branch 0 taken 4339 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4317 times.
✓ Branch 3 taken 22 times.
|
4339 | return (zc_min(v1,255)*zc_min(v2,255)) >> 8; |
| 7985 | } | ||
| 7986 | |||
| 7987 | 340 | int32_t get_emusic_volume() | |
| 7988 | { | ||
| 7989 | 340 | int32_t temp_volume = emusic_volume; | |
| 7990 |
3/4✓ Branch 0 taken 340 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 294 times.
✓ Branch 3 taken 46 times.
|
340 | if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME)) |
| 7991 | 46 | temp_volume = (emusic_volume * FFCore.usr_music_volume) / 10000 / 100; | |
| 7992 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 340 times.
|
340 | if (!zcmusic) |
| 7993 | 340 | return temp_volume; | |
| 7994 | ✗ | return (temp_volume * zcmusic->fadevolume) / 10000; | |
| 7995 | 340 | } | |
| 7996 | |||
| 7997 | ✗ | int32_t get_zcmusicpos() | |
| 7998 | { | ||
| 7999 | ✗ | int32_t debugtracething = zcmusic_get_curpos(zcmusic); | |
| 8000 | ✗ | return debugtracething; | |
| 8001 | return 0; | ||
| 8002 | } | ||
| 8003 | |||
| 8004 | ✗ | void set_zcmusicpos(int32_t position) | |
| 8005 | { | ||
| 8006 | ✗ | zcmusic_set_curpos(zcmusic, position); | |
| 8007 | ✗ | } | |
| 8008 | |||
| 8009 | ✗ | void set_zcmusicspeed(int32_t speed) | |
| 8010 | { | ||
| 8011 | ✗ | zcmusic_set_speed(zcmusic, speed); | |
| 8012 | ✗ | } | |
| 8013 | |||
| 8014 | ✗ | int32_t get_zcmusiclen() | |
| 8015 | { | ||
| 8016 | ✗ | return zcmusic_get_length(zcmusic); | |
| 8017 | } | ||
| 8018 | |||
| 8019 | 3 | void set_zcmusicloop(double start, double end) | |
| 8020 | { | ||
| 8021 | 3 | zcmusic_set_loop(zcmusic, start, end); | |
| 8022 | 3 | } | |
| 8023 | |||
| 8024 | 64179 | void jukebox(int32_t index,int32_t loop) | |
| 8025 | { | ||
| 8026 |
1/2✓ Branch 0 taken 64179 times.
✗ Branch 1 not taken.
|
64179 | if (is_headless()) |
| 8027 | 64179 | return; | |
| 8028 | |||
| 8029 | ✗ | music_stop(); | |
| 8030 | |||
| 8031 | ✗ | if(index<0) index=MAXMIDIS-1; | |
| 8032 | |||
| 8033 | ✗ | if(index>=MAXMIDIS) index=0; | |
| 8034 | |||
| 8035 | ✗ | music_stop(); | |
| 8036 | |||
| 8037 | // Allegro's DIGMID driver (the one normally used on on Linux) gets | ||
| 8038 | // stuck notes when a song stops. This fixes it. | ||
| 8039 | ✗ | if(strcmp(midi_driver->name, "DIGMID")==0) | |
| 8040 | ✗ | zc_set_volume(0, 0); | |
| 8041 | |||
| 8042 | ✗ | zc_set_volume(-1, mixvol(tunes[index].volume, midi_volume >>1)); | |
| 8043 | ✗ | zc_play_midi(tunes[index].data,loop); | |
| 8044 | |||
| 8045 | ✗ | if(tunes[index].start>0) | |
| 8046 | ✗ | zc_midi_seek(tunes[index].start); | |
| 8047 | |||
| 8048 | ✗ | midi_loop_start = tunes[index].loop_start; | |
| 8049 | ✗ | midi_loop_end = tunes[index].loop_end; | |
| 8050 | |||
| 8051 | ✗ | currmidi=index; | |
| 8052 | ✗ | master_volume(digi_volume, midi_volume); | |
| 8053 | //midi_paused=false; | ||
| 8054 | 64179 | } | |
| 8055 | |||
| 8056 | 64179 | void jukebox(int32_t index) | |
| 8057 | { | ||
| 8058 |
1/2✓ Branch 0 taken 64179 times.
✗ Branch 1 not taken.
|
64179 | if(index<0) index=MAXMIDIS-1; |
| 8059 | |||
| 8060 |
1/2✓ Branch 0 taken 64179 times.
✗ Branch 1 not taken.
|
64179 | if(index>=MAXMIDIS) index=0; |
| 8061 | |||
| 8062 | // do nothing if it's already playing | ||
| 8063 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 64179 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
64179 | if(index==currmidi && midi_pos>=0) |
| 8064 | { | ||
| 8065 | ✗ | return; | |
| 8066 | } | ||
| 8067 | |||
| 8068 | 64179 | jukebox(index,tunes[index].loop); | |
| 8069 | 64179 | } | |
| 8070 | |||
| 8071 | 110 | void play_DmapMusic() | |
| 8072 | { | ||
| 8073 |
1/2✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
|
110 | if (is_headless()) |
| 8074 | 110 | return; | |
| 8075 | |||
| 8076 | static char tfile[2048]; | ||
| 8077 | static int32_t ttrack=0; | ||
| 8078 | ✗ | bool domidi=false; | |
| 8079 | |||
| 8080 | ✗ | int32_t fadeoutframes = 0; | |
| 8081 | ✗ | if (zcmusic != NULL) | |
| 8082 | ✗ | fadeoutframes = zcmusic->fadeoutframes; | |
| 8083 | |||
| 8084 | ✗ | if(DMaps[cur_dmap].tmusic[0]!=0) | |
| 8085 | { | ||
| 8086 | ✗ | if(zcmusic==NULL || | |
| 8087 | ✗ | strcmp(zcmusic->filename,DMaps[cur_dmap].tmusic)!=0 || | |
| 8088 | ✗ | (zcmusic->type==ZCMF_GME && zcmusic->track != DMaps[cur_dmap].tmusictrack)) | |
| 8089 | { | ||
| 8090 | ✗ | if (DMaps[cur_dmap].tmusic_xfade_in > 0 || fadeoutframes > 0) | |
| 8091 | { | ||
| 8092 | ✗ | if (play_enh_music_crossfade(DMaps[cur_dmap].tmusic, qstpath, DMaps[cur_dmap].tmusictrack, get_emusic_volume(), DMaps[cur_dmap].tmusic_xfade_in, fadeoutframes)) | |
| 8093 | { | ||
| 8094 | ✗ | if (zcmusic != NULL) | |
| 8095 | { | ||
| 8096 | ✗ | zcmusic->fadeoutframes = DMaps[cur_dmap].tmusic_xfade_out; | |
| 8097 | ✗ | zcmusic_set_loop(zcmusic, double(DMaps[cur_dmap].tmusic_loop_start / 10000.0), double(DMaps[cur_dmap].tmusic_loop_end / 10000.0)); | |
| 8098 | ✗ | } | |
| 8099 | ✗ | } | |
| 8100 | ✗ | } | |
| 8101 | else | ||
| 8102 | { | ||
| 8103 | ✗ | if (zcmusic != NULL) | |
| 8104 | { | ||
| 8105 | ✗ | zcmusic_stop(zcmusic); | |
| 8106 | ✗ | zcmusic_unload_file(zcmusic); | |
| 8107 | ✗ | zcmusic = NULL; | |
| 8108 | ✗ | zcmixer->newtrack = NULL; | |
| 8109 | ✗ | } | |
| 8110 | |||
| 8111 | ✗ | zcmusic = zcmusic_load_for_quest(DMaps[cur_dmap].tmusic, qstpath).first; | |
| 8112 | ✗ | zcmixer->newtrack = zcmusic; | |
| 8113 | |||
| 8114 | ✗ | if (zcmusic != NULL) | |
| 8115 | { | ||
| 8116 | ✗ | zc_stop_midi(); | |
| 8117 | ✗ | strcpy(tfile, DMaps[cur_dmap].tmusic); | |
| 8118 | ✗ | zcmusic_play(zcmusic, emusic_volume); | |
| 8119 | ✗ | int32_t temptracks = 0; | |
| 8120 | ✗ | temptracks = zcmusic_get_tracks(zcmusic); | |
| 8121 | ✗ | temptracks = (temptracks < 2) ? 1 : temptracks; | |
| 8122 | ✗ | ttrack = vbound(DMaps[cur_dmap].tmusictrack, 0, temptracks - 1); | |
| 8123 | ✗ | zcmusic_change_track(zcmusic, ttrack); | |
| 8124 | ✗ | zcmusic_set_loop(zcmusic, double(DMaps[cur_dmap].tmusic_loop_start / 10000.0), double(DMaps[cur_dmap].tmusic_loop_end / 10000.0)); | |
| 8125 | ✗ | } | |
| 8126 | else | ||
| 8127 | { | ||
| 8128 | ✗ | tfile[0] = 0; | |
| 8129 | ✗ | domidi = true; | |
| 8130 | } | ||
| 8131 | } | ||
| 8132 | ✗ | } | |
| 8133 | ✗ | } | |
| 8134 | else | ||
| 8135 | { | ||
| 8136 | ✗ | if (DMaps[cur_dmap].midi == 0 && fadeoutframes > 0 && zcmusic != NULL && strcmp(zcmusic->filename, DMaps[cur_dmap].tmusic) != 0) | |
| 8137 | { | ||
| 8138 | ✗ | play_enh_music_crossfade(NULL, qstpath, DMaps[cur_dmap].tmusictrack, get_emusic_volume(), DMaps[cur_dmap].tmusic_xfade_in, fadeoutframes); | |
| 8139 | ✗ | } | |
| 8140 | else | ||
| 8141 | { | ||
| 8142 | ✗ | domidi = true; | |
| 8143 | } | ||
| 8144 | } | ||
| 8145 | |||
| 8146 | ✗ | if(domidi) | |
| 8147 | { | ||
| 8148 | ✗ | int32_t m=DMaps[cur_dmap].midi; | |
| 8149 | |||
| 8150 | ✗ | switch(m) | |
| 8151 | { | ||
| 8152 | case 1: | ||
| 8153 | ✗ | jukebox(ZC_MIDI_OVERWORLD); | |
| 8154 | ✗ | break; | |
| 8155 | |||
| 8156 | case 2: | ||
| 8157 | ✗ | jukebox(ZC_MIDI_DUNGEON); | |
| 8158 | ✗ | break; | |
| 8159 | |||
| 8160 | case 3: | ||
| 8161 | ✗ | jukebox(ZC_MIDI_LEVEL9); | |
| 8162 | ✗ | break; | |
| 8163 | |||
| 8164 | default: | ||
| 8165 | ✗ | if(m>=4 && m<4+MAXCUSTOMMIDIS) | |
| 8166 | ✗ | jukebox(m+MIDIOFFSET_DMAP); | |
| 8167 | else | ||
| 8168 | ✗ | music_stop(); | |
| 8169 | ✗ | } | |
| 8170 | ✗ | } | |
| 8171 | 110 | } | |
| 8172 | |||
| 8173 | 37444 | void playLevelMusic() | |
| 8174 | { | ||
| 8175 |
1/2✓ Branch 0 taken 37444 times.
✗ Branch 1 not taken.
|
37444 | if (is_headless()) |
| 8176 | 37444 | return; | |
| 8177 | |||
| 8178 | ✗ | int32_t m=hero_scr->screen_midi; | |
| 8179 | |||
| 8180 | ✗ | switch(m) | |
| 8181 | { | ||
| 8182 | case -2: | ||
| 8183 | ✗ | music_stop(); | |
| 8184 | ✗ | break; | |
| 8185 | |||
| 8186 | case -1: | ||
| 8187 | ✗ | play_DmapMusic(); | |
| 8188 | ✗ | break; | |
| 8189 | |||
| 8190 | case 1: | ||
| 8191 | ✗ | jukebox(ZC_MIDI_OVERWORLD); | |
| 8192 | ✗ | break; | |
| 8193 | |||
| 8194 | case 2: | ||
| 8195 | ✗ | jukebox(ZC_MIDI_DUNGEON); | |
| 8196 | ✗ | break; | |
| 8197 | |||
| 8198 | case 3: | ||
| 8199 | ✗ | jukebox(ZC_MIDI_LEVEL9); | |
| 8200 | ✗ | break; | |
| 8201 | |||
| 8202 | default: | ||
| 8203 | ✗ | if(m>=4 && m<4+MAXCUSTOMMIDIS) | |
| 8204 | ✗ | jukebox(m+MIDIOFFSET_MAPSCR); | |
| 8205 | else | ||
| 8206 | ✗ | music_stop(); | |
| 8207 | ✗ | } | |
| 8208 | 37444 | } | |
| 8209 | |||
| 8210 | 4339 | void master_volume(int32_t dv,int32_t mv) | |
| 8211 | { | ||
| 8212 |
7/8✓ Branch 0 taken 2008 times.
✓ Branch 1 taken 2331 times.
✓ Branch 2 taken 1967 times.
✓ Branch 3 taken 364 times.
✓ Branch 4 taken 2331 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1967 times.
✓ Branch 7 taken 364 times.
|
4339 | if(dv>=0) digi_volume=zc_max(zc_min(dv,255),0); |
| 8213 | |||
| 8214 |
7/8✓ Branch 0 taken 2004 times.
✓ Branch 1 taken 2335 times.
✓ Branch 2 taken 2000 times.
✓ Branch 3 taken 335 times.
✓ Branch 4 taken 2335 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2000 times.
✓ Branch 7 taken 335 times.
|
4339 | if(mv>=0) midi_volume=zc_max(zc_min(mv,255),0); |
| 8215 | |||
| 8216 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 4339 times.
✓ Branch 2 taken 4339 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4339 times.
|
4339 | int32_t i = zc_min(zc_max(currmidi,0),MAXMIDIS-1); |
| 8217 | 4339 | int32_t temp_vol = midi_volume; | |
| 8218 |
2/2✓ Branch 0 taken 4016 times.
✓ Branch 1 taken 323 times.
|
4339 | if (!get_qr(qr_OLD_SCRIPT_VOLUME)) |
| 8219 | 323 | temp_vol = (midi_volume * FFCore.usr_music_volume) / 10000 / 100; | |
| 8220 | 4339 | zc_set_volume(digi_volume,mixvol(tunes[i].volume, temp_vol)); | |
| 8221 | 4339 | } | |
| 8222 | |||
| 8223 | // array of voices, one for each sfx sample in the data file | ||
| 8224 | // 0+ = voice # | ||
| 8225 | // -1 = voice not allocated | ||
| 8226 | 323 | void Z_init_sound() | |
| 8227 | { | ||
| 8228 |
2/2✓ Branch 0 taken 82688 times.
✓ Branch 1 taken 323 times.
|
83011 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8229 | 82688 | sfx_voice[i]=-1; | |
| 8230 | |||
| 8231 | 323 | const char* midis[ZC_MIDI_COUNT] = { | |
| 8232 | "assets/dungeon.mid", | ||
| 8233 | "assets/ending.mid", | ||
| 8234 | "assets/gameover.mid", | ||
| 8235 | "assets/level9.mid", | ||
| 8236 | "assets/overworld.mid", | ||
| 8237 | "assets/title.mid", | ||
| 8238 | "assets/triforce.mid", | ||
| 8239 | }; | ||
| 8240 |
2/2✓ Branch 0 taken 2261 times.
✓ Branch 1 taken 323 times.
|
2584 | for(int32_t i=0; i<ZC_MIDI_COUNT; i++) |
| 8241 | { | ||
| 8242 | 2261 | tunes[i].data = load_midi(midis[i]); | |
| 8243 |
1/2✓ Branch 0 taken 2261 times.
✗ Branch 1 not taken.
|
2261 | if (!tunes[i].data) |
| 8244 | ✗ | Z_error_fatal("Missing required file %s\n", midis[i]); | |
| 8245 | 2261 | } | |
| 8246 | |||
| 8247 |
2/2✓ Branch 0 taken 81396 times.
✓ Branch 1 taken 323 times.
|
81719 | for(int32_t j=0; j<MAXCUSTOMMIDIS; j++) |
| 8248 | 81396 | tunes[ZC_MIDI_COUNT+j].data=NULL; | |
| 8249 | |||
| 8250 | 323 | master_volume(digi_volume,midi_volume); | |
| 8251 | 323 | } | |
| 8252 | |||
| 8253 | // returns number of voices currently allocated | ||
| 8254 | ✗ | int32_t sfx_count() | |
| 8255 | { | ||
| 8256 | ✗ | int32_t c=0; | |
| 8257 | |||
| 8258 | ✗ | for(int32_t i=0; i<WAV_COUNT; i++) | |
| 8259 | ✗ | if(sfx_voice[i]!=-1) | |
| 8260 | ✗ | ++c; | |
| 8261 | |||
| 8262 | ✗ | return c; | |
| 8263 | } | ||
| 8264 | |||
| 8265 | // clean up finished samples | ||
| 8266 | 19010727 | void sfx_cleanup() | |
| 8267 | { | ||
| 8268 |
2/2✓ Branch 0 taken 4866746112 times.
✓ Branch 1 taken 19010727 times.
|
4885756839 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8269 |
3/4✓ Branch 0 taken 1310532 times.
✓ Branch 1 taken 4865435580 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1310532 times.
|
4868056644 | if(sfx_voice[i]!=-1 && voice_get_position(sfx_voice[i])<0) |
| 8270 | { | ||
| 8271 | 1310532 | deallocate_voice(sfx_voice[i]); | |
| 8272 | 1310532 | sfx_voice[i]=-1; | |
| 8273 | 1310532 | } | |
| 8274 | 19010727 | } | |
| 8275 | |||
| 8276 | 1310712 | SAMPLE* sfx_get_sample(int32_t index) | |
| 8277 | { | ||
| 8278 | // check index | ||
| 8279 |
2/4✓ Branch 0 taken 1310712 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1310712 times.
|
1310712 | if (index<=0 || index>=WAV_COUNT) |
| 8280 | ✗ | return nullptr; | |
| 8281 | |||
| 8282 |
2/2✓ Branch 0 taken 446247 times.
✓ Branch 1 taken 864465 times.
|
1310712 | if (sfxdat) |
| 8283 | { | ||
| 8284 |
1/2✓ Branch 0 taken 446247 times.
✗ Branch 1 not taken.
|
446247 | if (index<Z35) |
| 8285 | { | ||
| 8286 | 446247 | return (SAMPLE*)sfxdata[index].dat; | |
| 8287 | } | ||
| 8288 | else | ||
| 8289 | { | ||
| 8290 | ✗ | return (SAMPLE*)sfxdata[Z35].dat; | |
| 8291 | } | ||
| 8292 | } | ||
| 8293 | else | ||
| 8294 | { | ||
| 8295 | 864465 | return &customsfxdata[index]; | |
| 8296 | } | ||
| 8297 | |||
| 8298 | return nullptr; | ||
| 8299 | 1310712 | } | |
| 8300 | |||
| 8301 | // allocates a voice for the sample "wav_index" (index into zelda.dat) | ||
| 8302 | // if a voice is already allocated (and/or playing), then it just returns true | ||
| 8303 | // Returns true: voice is allocated | ||
| 8304 | // false: unsuccessful | ||
| 8305 | 2065236 | bool sfx_init(int32_t index) | |
| 8306 | { | ||
| 8307 | // check index | ||
| 8308 |
3/4✓ Branch 0 taken 1468495 times.
✓ Branch 1 taken 596741 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1468495 times.
|
2065236 | if(index<=0 || index>=WAV_COUNT) |
| 8309 | 596741 | return false; | |
| 8310 | |||
| 8311 |
2/2✓ Branch 0 taken 157848 times.
✓ Branch 1 taken 1310647 times.
|
1468495 | if (sfx_voice[index] == -1) |
| 8312 | { | ||
| 8313 | 1310647 | SAMPLE* sample = sfx_get_sample(index); | |
| 8314 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1310647 times.
|
1310647 | if (!sample) |
| 8315 | ✗ | return false; | |
| 8316 | |||
| 8317 | 1310647 | sfx_voice[index] = allocate_voice(sample); | |
| 8318 | 1310647 | } | |
| 8319 | |||
| 8320 | 1468495 | return sfx_voice[index] != -1; | |
| 8321 | 2065236 | } | |
| 8322 | |||
| 8323 | ✗ | int32_t sfx_get_default_freq(int32_t index) | |
| 8324 | { | ||
| 8325 | ✗ | if (sfxdat) | |
| 8326 | { | ||
| 8327 | ✗ | if (index < Z35) | |
| 8328 | { | ||
| 8329 | ✗ | return ((SAMPLE*)sfxdata[index].dat)->freq; | |
| 8330 | } | ||
| 8331 | else | ||
| 8332 | { | ||
| 8333 | ✗ | return ((SAMPLE*)sfxdata[Z35].dat)->freq; | |
| 8334 | } | ||
| 8335 | } | ||
| 8336 | else | ||
| 8337 | { | ||
| 8338 | ✗ | return customsfxdata[index].freq; | |
| 8339 | } | ||
| 8340 | ✗ | } | |
| 8341 | |||
| 8342 | ✗ | int32_t sfx_get_length(int32_t index) | |
| 8343 | { | ||
| 8344 | ✗ | if (sfxdat) | |
| 8345 | { | ||
| 8346 | ✗ | if (index < Z35) | |
| 8347 | { | ||
| 8348 | ✗ | return int32_t(((SAMPLE*)sfxdata[index].dat)->len); | |
| 8349 | } | ||
| 8350 | else | ||
| 8351 | { | ||
| 8352 | ✗ | return int32_t(((SAMPLE*)sfxdata[Z35].dat)->len); | |
| 8353 | } | ||
| 8354 | } | ||
| 8355 | else | ||
| 8356 | { | ||
| 8357 | ✗ | return int32_t(customsfxdata[index].len); | |
| 8358 | } | ||
| 8359 | ✗ | } | |
| 8360 | |||
| 8361 | // plays an sfx sample | ||
| 8362 | 2065236 | void sfx(int32_t index,int32_t pan,bool loop, bool restart, int32_t vol, int32_t freq) | |
| 8363 | { | ||
| 8364 |
2/2✓ Branch 0 taken 1468495 times.
✓ Branch 1 taken 596741 times.
|
2065236 | if(!sfx_init(index)) |
| 8365 | 596741 | return; | |
| 8366 |
1/2✓ Branch 0 taken 1468495 times.
✗ Branch 1 not taken.
|
1468495 | if (!is_headless()) |
| 8367 | { | ||
| 8368 | ✗ | voice_set_playmode(sfx_voice[index], loop ? PLAYMODE_LOOP : PLAYMODE_PLAY); | |
| 8369 | ✗ | voice_set_pan(sfx_voice[index], pan); | |
| 8370 | |||
| 8371 | // Only used by ZScript currently | ||
| 8372 | ✗ | if (freq <= -1) | |
| 8373 | { | ||
| 8374 | ✗ | freq = sfx_get_default_freq(index); | |
| 8375 | ✗ | } | |
| 8376 | ✗ | voice_set_frequency(sfx_voice[index], freq); | |
| 8377 | |||
| 8378 | // Only used by ZScript currently | ||
| 8379 | ✗ | int32_t temp_volume = (sfx_volume * vol) / 10000 / 100; | |
| 8380 | ✗ | if (GameLoaded && !get_qr(qr_OLD_SCRIPT_VOLUME)) | |
| 8381 | ✗ | temp_volume = (temp_volume * FFCore.usr_sfx_volume) / 10000 / 100; | |
| 8382 | ✗ | voice_set_volume(sfx_voice[index], temp_volume); | |
| 8383 | |||
| 8384 | ✗ | int32_t pos = voice_get_position(sfx_voice[index]); | |
| 8385 | |||
| 8386 | ✗ | if (restart) voice_set_position(sfx_voice[index], 0); | |
| 8387 | |||
| 8388 | ✗ | if (pos <= 0) | |
| 8389 | ✗ | voice_start(sfx_voice[index]); | |
| 8390 | ✗ | } | |
| 8391 | |||
| 8392 |
3/4✓ Branch 0 taken 925993 times.
✓ Branch 1 taken 542502 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 925993 times.
|
1468495 | if (restart && replay_is_debug()) |
| 8393 | { | ||
| 8394 | // TODO(replays): get rid of this bandaid next time replays are mass-updated. | ||
| 8395 | 925993 | const char* sfx_name = sfx_string[index]; | |
| 8396 |
2/2✓ Branch 0 taken 914193 times.
✓ Branch 1 taken 11800 times.
|
925993 | if (strcmp(sfx_name, "Hero is hit") == 0) |
| 8397 | 11800 | sfx_name = "Player is hit"; | |
| 8398 |
2/2✓ Branch 0 taken 914066 times.
✓ Branch 1 taken 127 times.
|
914193 | else if (strcmp(sfx_name, "Hero dies") == 0) |
| 8399 | 127 | sfx_name = "Player dies"; | |
| 8400 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 925993 times.
|
925993 | replay_step_comment(fmt::format("sfx {}", sfx_name)); |
| 8401 | 925993 | } | |
| 8402 | 2065236 | } | |
| 8403 | |||
| 8404 | // true if sfx is allocated | ||
| 8405 | 234209 | bool sfx_allocated(int32_t index) | |
| 8406 | { | ||
| 8407 |
3/4✓ Branch 0 taken 33547 times.
✓ Branch 1 taken 200662 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 33547 times.
|
234209 | return (index>0 && index<WAV_COUNT && sfx_voice[index]!=-1); |
| 8408 | } | ||
| 8409 | |||
| 8410 | // start it (in loop mode) if it's not already playing, | ||
| 8411 | // otherwise adjust it to play in loop mode -DD | ||
| 8412 | 125902 | void cont_sfx(int32_t index) | |
| 8413 | { | ||
| 8414 |
1/2✓ Branch 0 taken 125902 times.
✗ Branch 1 not taken.
|
125902 | if (is_headless()) |
| 8415 | 125902 | return; | |
| 8416 | |||
| 8417 | ✗ | if(!sfx_init(index)) | |
| 8418 | { | ||
| 8419 | ✗ | return; | |
| 8420 | } | ||
| 8421 | |||
| 8422 | ✗ | if(voice_get_position(sfx_voice[index])<=0) | |
| 8423 | { | ||
| 8424 | ✗ | voice_set_position(sfx_voice[index],0); | |
| 8425 | ✗ | voice_set_playmode(sfx_voice[index],PLAYMODE_LOOP); | |
| 8426 | ✗ | voice_set_volume(sfx_voice[index], sfx_volume); | |
| 8427 | ✗ | voice_start(sfx_voice[index]); | |
| 8428 | ✗ | } | |
| 8429 | else | ||
| 8430 | { | ||
| 8431 | ✗ | adjust_sfx(index, 128, true); | |
| 8432 | } | ||
| 8433 | 125902 | } | |
| 8434 | |||
| 8435 | // adjust parameters while playing | ||
| 8436 | 5377 | void adjust_sfx(int32_t index,int32_t pan,bool loop) | |
| 8437 | { | ||
| 8438 |
4/6✓ Branch 0 taken 4828 times.
✓ Branch 1 taken 549 times.
✓ Branch 2 taken 4828 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4828 times.
|
5377 | if(index<=0 || index>=WAV_COUNT || sfx_voice[index]==-1) |
| 8439 | 5377 | return; | |
| 8440 | |||
| 8441 | ✗ | voice_set_playmode(sfx_voice[index],loop?PLAYMODE_LOOP:PLAYMODE_PLAY); | |
| 8442 | ✗ | voice_set_pan(sfx_voice[index],pan); | |
| 8443 | 5377 | } | |
| 8444 | |||
| 8445 | // pauses a voice | ||
| 8446 | 3364 | void pause_sfx(int32_t index) | |
| 8447 | { | ||
| 8448 |
3/6✓ Branch 0 taken 3364 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3364 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3364 times.
|
3364 | if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1) |
| 8449 | ✗ | voice_stop(sfx_voice[index]); | |
| 8450 | 3364 | } | |
| 8451 | |||
| 8452 | // resumes a voice | ||
| 8453 | 1427 | void resume_sfx(int32_t index) | |
| 8454 | { | ||
| 8455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1427 times.
|
1427 | if (is_headless()) |
| 8456 | 1427 | return; | |
| 8457 | |||
| 8458 | ✗ | if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1) | |
| 8459 | ✗ | voice_start(sfx_voice[index]); | |
| 8460 | 1427 | } | |
| 8461 | |||
| 8462 | // pauses all active voices | ||
| 8463 | 1129 | void pause_all_sfx() | |
| 8464 | { | ||
| 8465 |
2/2✓ Branch 0 taken 289024 times.
✓ Branch 1 taken 1129 times.
|
290153 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8466 |
2/2✓ Branch 0 taken 289022 times.
✓ Branch 1 taken 2 times.
|
289026 | if(sfx_voice[i]!=-1) |
| 8467 | 2 | voice_stop(sfx_voice[i]); | |
| 8468 | 1129 | } | |
| 8469 | |||
| 8470 | // resumes all paused voices | ||
| 8471 | 1070 | void resume_all_sfx() | |
| 8472 | { | ||
| 8473 |
2/2✓ Branch 0 taken 273920 times.
✓ Branch 1 taken 1070 times.
|
274990 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8474 |
1/2✓ Branch 0 taken 273920 times.
✗ Branch 1 not taken.
|
273920 | if(sfx_voice[i]!=-1) |
| 8475 | ✗ | voice_start(sfx_voice[i]); | |
| 8476 | 1070 | } | |
| 8477 | |||
| 8478 | // stops an sfx and deallocates the voice | ||
| 8479 | 15160910 | void stop_sfx(int32_t index) | |
| 8480 | { | ||
| 8481 |
3/4✓ Branch 0 taken 14907157 times.
✓ Branch 1 taken 253753 times.
✓ Branch 2 taken 14907157 times.
✗ Branch 3 not taken.
|
15160910 | if(index<=0 || index>=WAV_COUNT) |
| 8482 | 253753 | return; | |
| 8483 | |||
| 8484 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 14907100 times.
|
14907157 | if(sfx_voice[index]!=-1) |
| 8485 | { | ||
| 8486 | 57 | deallocate_voice(sfx_voice[index]); | |
| 8487 | 57 | sfx_voice[index]=-1; | |
| 8488 | 57 | } | |
| 8489 | 15160910 | } | |
| 8490 | |||
| 8491 | // Stops SFX played by Hero's item of the given family | ||
| 8492 | 163371 | void stop_item_sfx(int32_t family) | |
| 8493 | { | ||
| 8494 | 163371 | int32_t id=current_item_id(family); | |
| 8495 | |||
| 8496 |
2/2✓ Branch 0 taken 162269 times.
✓ Branch 1 taken 1102 times.
|
163371 | if(id<0) |
| 8497 | 162269 | return; | |
| 8498 | |||
| 8499 | 1102 | stop_sfx(itemsbuf[id].usesound); | |
| 8500 | 163371 | } | |
| 8501 | |||
| 8502 | 9760 | void kill_sfx() | |
| 8503 | { | ||
| 8504 |
2/2✓ Branch 0 taken 2498560 times.
✓ Branch 1 taken 9760 times.
|
2508320 | for(int32_t i=0; i<WAV_COUNT; i++) |
| 8505 |
2/2✓ Branch 0 taken 2498502 times.
✓ Branch 1 taken 58 times.
|
2498618 | if(sfx_voice[i]!=-1) |
| 8506 | { | ||
| 8507 | 58 | deallocate_voice(sfx_voice[i]); | |
| 8508 | 58 | sfx_voice[i]=-1; | |
| 8509 | 58 | } | |
| 8510 | 9760 | } | |
| 8511 | |||
| 8512 | // TODO: when far out of bounds, sounds should dampen. currently we only pan. | ||
| 8513 | 1256758 | int32_t pan(int32_t x) | |
| 8514 | { | ||
| 8515 |
1/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1256758 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
1256758 | switch(pan_style) |
| 8516 | { | ||
| 8517 | // MONO | ||
| 8518 | case 0: | ||
| 8519 | ✗ | return 128; | |
| 8520 | |||
| 8521 | // 1/2 | ||
| 8522 | case 1: | ||
| 8523 | 1256758 | x -= viewport.x; | |
| 8524 | 1256758 | return vbound((x>>1)+68,0,255); | |
| 8525 | |||
| 8526 | // 3/4 | ||
| 8527 | case 2: | ||
| 8528 | ✗ | x -= viewport.x; | |
| 8529 | ✗ | return vbound(((x*3)>>2)+36,0,255); | |
| 8530 | |||
| 8531 | // FULL | ||
| 8532 | ✗ | case 3: | |
| 8533 | default: | ||
| 8534 | ✗ | x -= viewport.x; | |
| 8535 | ✗ | return vbound(x,0,255); | |
| 8536 | } | ||
| 8537 | 1256758 | } | |
| 8538 | |||
| 8539 | 52063298 | bool joybtn(int32_t b) | |
| 8540 | { | ||
| 8541 |
1/2✓ Branch 0 taken 52063298 times.
✗ Branch 1 not taken.
|
52063298 | if(b == 0) |
| 8542 | ✗ | return false; | |
| 8543 |
1/2✓ Branch 0 taken 52063298 times.
✗ Branch 1 not taken.
|
52063298 | if (b-1 >= joy[joystick_index].num_buttons) |
| 8544 | 52063298 | return false; | |
| 8545 | |||
| 8546 | ✗ | return joy[joystick_index].button[b-1].b !=0; | |
| 8547 | 52063298 | } | |
| 8548 | |||
| 8549 | ✗ | bool joystick(int32_t s) | |
| 8550 | { | ||
| 8551 | ✗ | if(s < 0) | |
| 8552 | ✗ | return false; | |
| 8553 | ✗ | if (s >= joy[joystick_index].num_sticks) | |
| 8554 | ✗ | return false; | |
| 8555 | |||
| 8556 | ✗ | for (int i = 0; i < joy[joystick_index].stick[s].num_axis; i++) | |
| 8557 | { | ||
| 8558 | ✗ | if (joy[joystick_index].stick[s].axis[i].d1 || joy[joystick_index].stick[s].axis[i].d2) | |
| 8559 | ✗ | return true; | |
| 8560 | ✗ | } | |
| 8561 | ✗ | return false; | |
| 8562 | ✗ | } | |
| 8563 | |||
| 8564 | ✗ | const char* joybtn_name(int32_t b) | |
| 8565 | { | ||
| 8566 | ✗ | if (b <= 0 || b > joy[joystick_index].num_buttons) | |
| 8567 | ✗ | return ""; | |
| 8568 | |||
| 8569 | ✗ | return joy[joystick_index].button[b-1].name; | |
| 8570 | ✗ | } | |
| 8571 | |||
| 8572 | ✗ | const char* joystick_name(int32_t s) | |
| 8573 | { | ||
| 8574 | ✗ | if (s < 0 || s >= joy[joystick_index].num_sticks) | |
| 8575 | ✗ | return ""; | |
| 8576 | |||
| 8577 | ✗ | return joy[joystick_index].stick[s].name; | |
| 8578 | ✗ | } | |
| 8579 | |||
| 8580 | ✗ | int32_t button_pressed() | |
| 8581 | { | ||
| 8582 | ✗ | if (joystick_index >= MAX_JOYSTICKS) | |
| 8583 | ✗ | return 0; | |
| 8584 | |||
| 8585 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8586 | { | ||
| 8587 | ✗ | if(joybtn(i)) | |
| 8588 | ✗ | return i; | |
| 8589 | ✗ | } | |
| 8590 | |||
| 8591 | ✗ | return 0; | |
| 8592 | ✗ | } | |
| 8593 | |||
| 8594 | int32_t next_press_key(); | ||
| 8595 | |||
| 8596 | ✗ | int32_t next_joy_input(bool buttons) | |
| 8597 | { | ||
| 8598 | ✗ | clear_keybuf(); | |
| 8599 | |||
| 8600 | //first, we need to wait until they're pressing no buttons | ||
| 8601 | ✗ | for(;;) | |
| 8602 | { | ||
| 8603 | ✗ | if(keypressed()) | |
| 8604 | { | ||
| 8605 | ✗ | switch(readkey()>>8) | |
| 8606 | { | ||
| 8607 | case KEY_ESC: | ||
| 8608 | ✗ | return -1; | |
| 8609 | |||
| 8610 | case KEY_SPACE: | ||
| 8611 | ✗ | return 0; | |
| 8612 | } | ||
| 8613 | ✗ | } | |
| 8614 | |||
| 8615 | ✗ | poll_joystick(); | |
| 8616 | ✗ | bool done = true; | |
| 8617 | |||
| 8618 | ✗ | if (buttons) | |
| 8619 | { | ||
| 8620 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8621 | { | ||
| 8622 | ✗ | if(joybtn(i)) done = false; | |
| 8623 | ✗ | } | |
| 8624 | ✗ | } | |
| 8625 | else | ||
| 8626 | { | ||
| 8627 | ✗ | if (!gamepad_dlg_cur_joystick || !al_get_joystick_active(gamepad_dlg_cur_joystick)) | |
| 8628 | { | ||
| 8629 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 8630 | ✗ | return -2; | |
| 8631 | } | ||
| 8632 | ✗ | for(int32_t i=0; i<joy[joystick_index].num_sticks; i++) | |
| 8633 | { | ||
| 8634 | ✗ | if(joystick(i)) done = false; | |
| 8635 | ✗ | } | |
| 8636 | } | ||
| 8637 | |||
| 8638 | ✗ | if(done) break; | |
| 8639 | ✗ | rest(1); | |
| 8640 | } | ||
| 8641 | |||
| 8642 | //now, we need to wait for them to press any button | ||
| 8643 | ✗ | for(;;) | |
| 8644 | { | ||
| 8645 | ✗ | if(keypressed()) | |
| 8646 | { | ||
| 8647 | ✗ | switch(readkey()>>8) | |
| 8648 | { | ||
| 8649 | case KEY_ESC: | ||
| 8650 | ✗ | return -1; | |
| 8651 | |||
| 8652 | case KEY_SPACE: | ||
| 8653 | ✗ | return 0; | |
| 8654 | } | ||
| 8655 | ✗ | } | |
| 8656 | |||
| 8657 | ✗ | poll_joystick(); | |
| 8658 | |||
| 8659 | ✗ | if (buttons) | |
| 8660 | { | ||
| 8661 | ✗ | if (!gamepad_dlg_cur_joystick || !al_get_joystick_active(gamepad_dlg_cur_joystick)) | |
| 8662 | { | ||
| 8663 | ✗ | InfoDialog("ZC", "Invalid gamepad. Did it disconnect?").show(); | |
| 8664 | ✗ | return -2; | |
| 8665 | } | ||
| 8666 | ✗ | for(int32_t i=1; i<=joy[joystick_index].num_buttons; i++) | |
| 8667 | { | ||
| 8668 | ✗ | if(joybtn(i)) | |
| 8669 | ✗ | return i; | |
| 8670 | ✗ | } | |
| 8671 | ✗ | } | |
| 8672 | else | ||
| 8673 | { | ||
| 8674 | ✗ | for(int32_t i=0; i<joy[joystick_index].num_sticks; i++) | |
| 8675 | { | ||
| 8676 | ✗ | if(joystick(i)) | |
| 8677 | ✗ | return i; | |
| 8678 | ✗ | } | |
| 8679 | } | ||
| 8680 | ✗ | rest(1); | |
| 8681 | } | ||
| 8682 | ✗ | } | |
| 8683 | |||
| 8684 | 12806099 | static bool rButton(bool &btn, bool &flag, bool rawbtn) | |
| 8685 | { | ||
| 8686 |
2/2✓ Branch 0 taken 12722418 times.
✓ Branch 1 taken 83681 times.
|
12806099 | bool ret = btn && !flag; |
| 8687 | 12806099 | flag = rawbtn; | |
| 8688 | |||
| 8689 | 12806099 | return ret; | |
| 8690 | } | ||
| 8691 | 387812858 | static bool rButton(bool &btn, bool &flag) | |
| 8692 | { | ||
| 8693 |
2/2✓ Branch 0 taken 373295955 times.
✓ Branch 1 taken 14516903 times.
|
387812858 | bool ret = btn && !flag; |
| 8694 | 387812858 | flag = btn; | |
| 8695 | |||
| 8696 | 387812858 | return ret; | |
| 8697 | } | ||
| 8698 | 4658044 | static bool rButtonPeek(bool btn, bool flag) | |
| 8699 | { | ||
| 8700 |
2/2✓ Branch 0 taken 4308953 times.
✓ Branch 1 taken 349091 times.
|
4658044 | if(!btn) |
| 8701 | { | ||
| 8702 | 4308953 | return false; | |
| 8703 | } | ||
| 8704 |
2/2✓ Branch 0 taken 33877 times.
✓ Branch 1 taken 315214 times.
|
349091 | else if(!flag) |
| 8705 | { | ||
| 8706 | 33877 | return true; | |
| 8707 | } | ||
| 8708 | |||
| 8709 | 315214 | return false; | |
| 8710 | 4658044 | } | |
| 8711 | |||
| 8712 | // Updated only by keyboard/gamepad. | ||
| 8713 | // If in replay mode, this is set directly by the replay system. | ||
| 8714 | // This should never be read from directly - use control_state instead. | ||
| 8715 | bool raw_control_state[ZC_CONTROL_STATES]; | ||
| 8716 | |||
| 8717 | // Every call to load_control_state (pretty much every frame) resets this to be equal to raw_control_state. | ||
| 8718 | // This state can drift from raw_control_state if button states are "eaten" or overriden by a script. But that only | ||
| 8719 | // lasts until the next call to load_control_state. | ||
| 8720 | bool control_state[ZC_CONTROL_STATES]; | ||
| 8721 | bool disable_control[ZC_CONTROL_STATES]; | ||
| 8722 | bool drunk_toggle_state[11]; | ||
| 8723 | bool disabledKeys[127]; | ||
| 8724 | bool KeyInput[127]; | ||
| 8725 | bool KeyPress[127]; | ||
| 8726 | |||
| 8727 | bool key_current_frame[127]; | ||
| 8728 | bool key_previous_frame[127]; | ||
| 8729 | |||
| 8730 | static bool key_system[127]; | ||
| 8731 | static bool key_system_previous[127]; | ||
| 8732 | static bool key_system_press[127]; | ||
| 8733 | |||
| 8734 | bool button_press[ZC_CONTROL_STATES]; | ||
| 8735 | bool button_hold[ZC_CONTROL_STATES]; | ||
| 8736 | |||
| 8737 | #define STICK_1_X joy[joystick_index].stick[js_stick_1_x_stick].axis[js_stick_1_x_axis] | ||
| 8738 | #define STICK_1_Y joy[joystick_index].stick[js_stick_1_y_stick].axis[js_stick_1_y_axis] | ||
| 8739 | #define STICK_2_X joy[joystick_index].stick[js_stick_2_x_stick].axis[js_stick_2_x_axis] | ||
| 8740 | #define STICK_2_Y joy[joystick_index].stick[js_stick_2_y_stick].axis[js_stick_2_y_axis] | ||
| 8741 | #define STICK_PRECISION 56 //define your own sensitivity | ||
| 8742 | |||
| 8743 | 16269090 | void load_control_state() | |
| 8744 | { | ||
| 8745 | 16269090 | load_control_called_this_frame = true; | |
| 8746 | |||
| 8747 |
2/2✓ Branch 0 taken 13066028 times.
✓ Branch 1 taken 3203062 times.
|
16269090 | if (replay_version_check(8, 11)) |
| 8748 | { | ||
| 8749 |
2/2✓ Branch 0 taken 57655116 times.
✓ Branch 1 taken 3203062 times.
|
60858178 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 8750 | 57655116 | down_control_states[i] = raw_control_state[i]; | |
| 8751 | 3203062 | } | |
| 8752 | |||
| 8753 |
2/2✓ Branch 0 taken 16269069 times.
✓ Branch 1 taken 21 times.
|
16269090 | if (!replay_is_replaying()) |
| 8754 | { | ||
| 8755 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[0]=zc_getrawkey(DUkey, true)||(analog_movement ? STICK_1_Y.d1 || STICK_1_Y.pos - js_stick_1_y_offset < -STICK_PRECISION : joybtn(DUbtn)); |
| 8756 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[1]=zc_getrawkey(DDkey, true)||(analog_movement ? STICK_1_Y.d2 || STICK_1_Y.pos - js_stick_1_y_offset > STICK_PRECISION : joybtn(DDbtn)); |
| 8757 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[2]=zc_getrawkey(DLkey, true)||(analog_movement ? STICK_1_X.d1 || STICK_1_X.pos - js_stick_1_x_offset < -STICK_PRECISION : joybtn(DLbtn)); |
| 8758 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
21 | raw_control_state[3]=zc_getrawkey(DRkey, true)||(analog_movement ? STICK_1_X.d2 || STICK_1_X.pos - js_stick_1_x_offset > STICK_PRECISION : joybtn(DRbtn)); |
| 8759 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[4]=zc_getrawkey(Akey, true)||joybtn(Abtn); |
| 8760 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[5]=zc_getrawkey(Bkey, true)||joybtn(Bbtn); |
| 8761 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[6]=zc_getrawkey(Skey, true)||joybtn(Sbtn); |
| 8762 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[7]=zc_getrawkey(Lkey, true)||joybtn(Lbtn); |
| 8763 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[8]=zc_getrawkey(Rkey, true)||joybtn(Rbtn); |
| 8764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[9]=zc_getrawkey(Pkey, true)||joybtn(Pbtn); |
| 8765 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[10]=zc_getrawkey(Exkey1, true)||joybtn(Exbtn1); |
| 8766 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[11]=zc_getrawkey(Exkey2, true)||joybtn(Exbtn2); |
| 8767 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[12]=zc_getrawkey(Exkey3, true)||joybtn(Exbtn3); |
| 8768 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | raw_control_state[13]=zc_getrawkey(Exkey4, true)||joybtn(Exbtn4); |
| 8769 | |||
| 8770 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | if(num_joysticks != 0) |
| 8771 | { | ||
| 8772 | ✗ | raw_control_state[14] = STICK_2_Y.pos - js_stick_2_y_offset < -STICK_PRECISION; | |
| 8773 | ✗ | raw_control_state[15] = STICK_2_Y.pos - js_stick_2_y_offset > STICK_PRECISION; | |
| 8774 | ✗ | raw_control_state[16] = STICK_2_X.pos - js_stick_2_x_offset < -STICK_PRECISION; | |
| 8775 | ✗ | raw_control_state[17] = STICK_2_X.pos - js_stick_2_x_offset > STICK_PRECISION; | |
| 8776 | ✗ | } | |
| 8777 | else | ||
| 8778 | { | ||
| 8779 | 21 | raw_control_state[14] = false; | |
| 8780 | 21 | raw_control_state[15] = false; | |
| 8781 | 21 | raw_control_state[16] = false; | |
| 8782 | 21 | raw_control_state[17] = false; | |
| 8783 | } | ||
| 8784 | 21 | } | |
| 8785 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 16269085 times.
|
16269090 | if (replay_is_active()) |
| 8786 | { | ||
| 8787 |
2/2✓ Branch 0 taken 1211700 times.
✓ Branch 1 taken 15057385 times.
|
16269085 | if (replay_get_version() < 3) |
| 8788 | 1211700 | replay_poll(); | |
| 8789 |
4/4✓ Branch 0 taken 15057364 times.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 13295989 times.
✓ Branch 3 taken 1761375 times.
|
15057385 | else if (replay_is_replaying() && replay_get_version() < 6) |
| 8790 | 1761375 | replay_peek_input(); | |
| 8791 |
4/4✓ Branch 0 taken 13295989 times.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 10092927 times.
✓ Branch 3 taken 3203062 times.
|
13296010 | else if (replay_is_replaying() && replay_version_check(8, 11)) |
| 8792 | 3203062 | replay_peek_input(); | |
| 8793 |
2/2✓ Branch 0 taken 14929143 times.
✓ Branch 1 taken 1339942 times.
|
16269085 | if (replay_get_version() == 8) |
| 8794 | 1339942 | update_keys(); | |
| 8795 | 16269085 | } | |
| 8796 | |||
| 8797 | // Some test replay files were made before a serious input bug was fixed, so instead | ||
| 8798 | // of re-doing them or tossing them out, just check for that zplay version. | ||
| 8799 |
3/4✓ Branch 0 taken 16269080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 121900 times.
✓ Branch 3 taken 16147180 times.
|
16269090 | bool botched_input = replay_is_active() && replay_get_version() != 1 && replay_get_version() < 8; |
| 8800 |
2/2✓ Branch 0 taken 292843440 times.
✓ Branch 1 taken 16269080 times.
|
309112520 | for (int i = 0; i < ZC_CONTROL_STATES; i++) |
| 8801 | { | ||
| 8802 | 292843440 | control_state[i] = raw_control_state[i]; | |
| 8803 |
4/4✓ Branch 0 taken 53024004 times.
✓ Branch 1 taken 239819436 times.
✓ Branch 2 taken 2611994 times.
✓ Branch 3 taken 50412010 times.
|
292843440 | if (botched_input && !control_state[i]) |
| 8804 | 50412010 | down_control_states[i] = false; | |
| 8805 | 292843440 | } | |
| 8806 | 16269080 | bool did_bad_cutscene_btn = false; | |
| 8807 |
2/2✓ Branch 0 taken 16269080 times.
✓ Branch 1 taken 292843440 times.
|
309112520 | for(int q = 0; q < 18; ++q) |
| 8808 |
4/4✓ Branch 0 taken 13941524 times.
✓ Branch 1 taken 278901916 times.
✓ Branch 2 taken 13939813 times.
✓ Branch 3 taken 1711 times.
|
292845151 | if(control_state[q] && !active_cutscene.can_button(q)) |
| 8809 | { | ||
| 8810 | 1711 | control_state[q] = false; | |
| 8811 | 1711 | did_bad_cutscene_btn = true; | |
| 8812 | 1711 | } | |
| 8813 |
2/2✓ Branch 0 taken 16267813 times.
✓ Branch 1 taken 1267 times.
|
16269080 | if(did_bad_cutscene_btn) |
| 8814 | 1267 | active_cutscene.error(); | |
| 8815 | |||
| 8816 | 16269080 | button_press[0]=rButton(control_state[0],button_hold[0]); | |
| 8817 | 16269080 | button_press[1]=rButton(control_state[1],button_hold[1]); | |
| 8818 | 16269080 | button_press[2]=rButton(control_state[2],button_hold[2]); | |
| 8819 | 16269080 | button_press[3]=rButton(control_state[3],button_hold[3]); | |
| 8820 | 16269080 | button_press[4]=rButton(control_state[4],button_hold[4]); | |
| 8821 | 16269080 | button_press[5]=rButton(control_state[5],button_hold[5]); | |
| 8822 | 16269080 | button_press[6]=rButton(control_state[6],button_hold[6]); | |
| 8823 | 16269080 | button_press[7]=rButton(control_state[7],button_hold[7]); | |
| 8824 | 16269080 | button_press[8]=rButton(control_state[8],button_hold[8]); | |
| 8825 | 16269080 | button_press[9]=rButton(control_state[9],button_hold[9]); | |
| 8826 | 16269080 | button_press[10]=rButton(control_state[10],button_hold[10]); | |
| 8827 | 16269080 | button_press[11]=rButton(control_state[11],button_hold[11]); | |
| 8828 | 16269080 | button_press[12]=rButton(control_state[12],button_hold[12]); | |
| 8829 | 16269080 | button_press[13]=rButton(control_state[13],button_hold[13]); | |
| 8830 | 16269080 | button_press[14]=rButton(control_state[14],button_hold[14]); | |
| 8831 | 16269080 | button_press[15]=rButton(control_state[15],button_hold[15]); | |
| 8832 | 16269080 | button_press[16]=rButton(control_state[16],button_hold[16]); | |
| 8833 | 16269080 | button_press[17]=rButton(control_state[17],button_hold[17]); | |
| 8834 | 16269080 | } | |
| 8835 | |||
| 8836 | // Returns true if any game key is pressed. This is needed because keypressed() | ||
| 8837 | // doesn't detect modifier keys and control_state[] can be modified by scripts. | ||
| 8838 | 81383241 | bool zc_key_pressed() | |
| 8839 | //may also need to use zc_getrawkey | ||
| 8840 | { | ||
| 8841 |
7/10✓ Branch 0 taken 65669909 times.
✓ Branch 1 taken 15713332 times.
✓ Branch 2 taken 15713332 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15713332 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12839449 times.
✓ Branch 7 taken 12839449 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5123906 times.
|
86507147 | if((zc_getrawkey(DUkey, true)||(analog_movement ? STICK_1_Y.d1 || STICK_1_Y.pos - js_stick_1_y_offset< -STICK_PRECISION : joybtn(DUbtn))) || |
| 8842 |
4/6✓ Branch 0 taken 12839449 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12839449 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9756002 times.
✓ Branch 5 taken 9756002 times.
|
12839449 | (zc_getrawkey(DDkey, true)||(analog_movement ? STICK_1_Y.d2 || STICK_1_Y.pos - js_stick_1_y_offset > STICK_PRECISION : joybtn(DDbtn))) || |
| 8843 |
4/6✓ Branch 0 taken 9756002 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9756002 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6454539 times.
✓ Branch 5 taken 6454539 times.
|
9756002 | (zc_getrawkey(DLkey, true)||(analog_movement ? STICK_1_X.d1 || STICK_1_X.pos - js_stick_1_x_offset < -STICK_PRECISION : joybtn(DLbtn))) || |
| 8844 |
4/6✓ Branch 0 taken 6454539 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6454539 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5543150 times.
✓ Branch 5 taken 5543150 times.
|
6454539 | (zc_getrawkey(DRkey, true)||(analog_movement ? STICK_1_X.d2 || STICK_1_X.pos - js_stick_1_x_offset > STICK_PRECISION : joybtn(DRbtn))) || |
| 8845 |
1/2✓ Branch 0 taken 5543150 times.
✗ Branch 1 not taken.
|
5543150 | (zc_getrawkey(Akey, true)||joybtn(Abtn)) || |
| 8846 |
3/4✓ Branch 0 taken 5349452 times.
✓ Branch 1 taken 193698 times.
✓ Branch 2 taken 5349452 times.
✗ Branch 3 not taken.
|
5543150 | (zc_getrawkey(Bkey, true)||joybtn(Bbtn)) || |
| 8847 |
3/4✓ Branch 0 taken 5201299 times.
✓ Branch 1 taken 148153 times.
✓ Branch 2 taken 5201299 times.
✗ Branch 3 not taken.
|
5349452 | (zc_getrawkey(Skey, true)||joybtn(Sbtn)) || |
| 8848 |
3/4✓ Branch 0 taken 5177796 times.
✓ Branch 1 taken 23503 times.
✓ Branch 2 taken 5177796 times.
✗ Branch 3 not taken.
|
5201299 | (zc_getrawkey(Lkey, true)||joybtn(Lbtn)) || |
| 8849 |
3/4✓ Branch 0 taken 5150623 times.
✓ Branch 1 taken 27173 times.
✓ Branch 2 taken 5150623 times.
✗ Branch 3 not taken.
|
5177796 | (zc_getrawkey(Rkey, true)||joybtn(Rbtn)) || |
| 8850 |
3/4✓ Branch 0 taken 5143068 times.
✓ Branch 1 taken 7555 times.
✓ Branch 2 taken 5143068 times.
✗ Branch 3 not taken.
|
5150623 | (zc_getrawkey(Pkey, true)||joybtn(Pbtn)) || |
| 8851 |
3/4✓ Branch 0 taken 5125829 times.
✓ Branch 1 taken 17239 times.
✓ Branch 2 taken 5125829 times.
✗ Branch 3 not taken.
|
5143068 | (zc_getrawkey(Exkey1, true)||joybtn(Exbtn1)) || |
| 8852 |
3/4✓ Branch 0 taken 5124000 times.
✓ Branch 1 taken 1829 times.
✓ Branch 2 taken 5124000 times.
✗ Branch 3 not taken.
|
5125829 | (zc_getrawkey(Exkey2, true)||joybtn(Exbtn2)) || |
| 8853 |
3/4✓ Branch 0 taken 5123965 times.
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 5123965 times.
✗ Branch 3 not taken.
|
5124000 | (zc_getrawkey(Exkey3, true)||joybtn(Exbtn3)) || |
| 8854 |
2/2✓ Branch 0 taken 5123906 times.
✓ Branch 1 taken 59 times.
|
5123965 | (zc_getrawkey(Exkey4, true)||joybtn(Exbtn4))) // Skipping joystick axes |
| 8855 | 145445615 | return true; | |
| 8856 | |||
| 8857 | 5123906 | return false; | |
| 8858 | 19229703 | } | |
| 8859 | |||
| 8860 | 311902181 | bool getInput(int32_t btn, int input_flags) | |
| 8861 | { | ||
| 8862 |
3/4✓ Branch 0 taken 277998546 times.
✓ Branch 1 taken 33903635 times.
✓ Branch 2 taken 277998546 times.
✗ Branch 3 not taken.
|
311902181 | if((input_flags & INPUT_HERO_ACTION) && Hero.no_control()) |
| 8863 | ✗ | return false; | |
| 8864 | |||
| 8865 | 311902181 | bool press = input_flags & INPUT_PRESS; | |
| 8866 | 311902181 | bool drunk = input_flags & INPUT_DRUNK; | |
| 8867 | 311902181 | bool ignoreDisable = input_flags & INPUT_IGNORE_DISABLE; | |
| 8868 | 311902181 | bool eatEntirely = input_flags & INPUT_EAT_ENTIRELY; | |
| 8869 | 311902181 | bool peek = input_flags & INPUT_PEEK; | |
| 8870 | |||
| 8871 | 311902181 | bool ret = false, drunkstate = false, rawret = false;; | |
| 8872 | 311902181 | bool* flag = &down_control_states[btn]; | |
| 8873 |
2/7✓ Branch 0 taken 292653209 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 19248972 times.
|
311902181 | switch(btn) |
| 8874 | { | ||
| 8875 | case btnF12: | ||
| 8876 | ✗ | ret = zc_getkey(KEY_F12, ignoreDisable); | |
| 8877 | ✗ | rawret = zc_getrawkey(KEY_F12, ignoreDisable); | |
| 8878 | ✗ | eatEntirely = false; | |
| 8879 | ✗ | break; | |
| 8880 | case btnF11: | ||
| 8881 | ✗ | ret = zc_getkey(KEY_F11, ignoreDisable); | |
| 8882 | ✗ | rawret = zc_getrawkey(KEY_F11, ignoreDisable); | |
| 8883 | ✗ | eatEntirely = false; | |
| 8884 | ✗ | break; | |
| 8885 | case btnF5: | ||
| 8886 | ✗ | ret = zc_getkey(KEY_F5, ignoreDisable); | |
| 8887 | ✗ | rawret = zc_getrawkey(KEY_F5, ignoreDisable); | |
| 8888 | ✗ | eatEntirely = false; | |
| 8889 | ✗ | break; | |
| 8890 | case btnQ: | ||
| 8891 | ✗ | ret = zc_getkey(KEY_Q, ignoreDisable); | |
| 8892 | ✗ | rawret = zc_getrawkey(KEY_Q, ignoreDisable); | |
| 8893 | ✗ | eatEntirely = false; | |
| 8894 | ✗ | break; | |
| 8895 | case btnI: | ||
| 8896 | ✗ | ret = zc_getkey(KEY_I, ignoreDisable); | |
| 8897 | ✗ | rawret = zc_getrawkey(KEY_I, ignoreDisable); | |
| 8898 | ✗ | eatEntirely = false; | |
| 8899 | ✗ | break; | |
| 8900 | case btnM: | ||
| 8901 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19248972 times.
|
19248972 | if(FFCore.kb_typing_mode) return false; |
| 8902 | 19248972 | rawret = ret = zc_getrawkey(KEY_ESC, ignoreDisable); | |
| 8903 | 19248972 | eatEntirely = false; | |
| 8904 | 19248972 | break; | |
| 8905 | default: //control_state[] index | ||
| 8906 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 292653209 times.
|
292653209 | if(FFCore.kb_typing_mode) return false; |
| 8907 |
6/6✓ Branch 0 taken 291255979 times.
✓ Branch 1 taken 1397230 times.
✓ Branch 2 taken 29315404 times.
✓ Branch 3 taken 261940575 times.
✓ Branch 4 taken 29312431 times.
✓ Branch 5 taken 2973 times.
|
292653209 | if(!ignoreDisable && get_qr(qr_FIXDRUNKINPUTS) && disable_control[btn]) drunk = false; |
| 8908 |
2/2✓ Branch 0 taken 17525518 times.
✓ Branch 1 taken 275124718 times.
|
292650236 | else if(btn<11) drunkstate = drunk_toggle_state[btn]; |
| 8909 |
4/4✓ Branch 0 taken 259655930 times.
✓ Branch 1 taken 32997279 times.
✓ Branch 2 taken 7283 times.
✓ Branch 3 taken 32989996 times.
|
325650488 | ret = control_state[btn] && (ignoreDisable || !disable_control[btn]); |
| 8910 | 292653209 | rawret = raw_control_state[btn]; | |
| 8911 | 292653209 | } | |
| 8912 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 311902181 times.
|
311902181 | assert(flag); |
| 8913 |
2/2✓ Branch 0 taken 199468620 times.
✓ Branch 1 taken 112433561 times.
|
311902181 | if(press) |
| 8914 | { | ||
| 8915 |
2/2✓ Branch 0 taken 4658044 times.
✓ Branch 1 taken 107775517 times.
|
112433561 | if(peek) |
| 8916 | 4658044 | ret = rButtonPeek(ret, *flag); | |
| 8917 |
2/2✓ Branch 0 taken 94969418 times.
✓ Branch 1 taken 12806099 times.
|
107775517 | else if(get_qr(qr_BROKEN_INPUT_DOWN_STATE)) ret = rButton(ret, *flag); |
| 8918 | 12806099 | else ret = rButton(ret, *flag, rawret); | |
| 8919 | 112433561 | } | |
| 8920 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 311902181 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
311902181 | if(eatEntirely && ret) control_state[btn] = false; |
| 8921 |
4/4✓ Branch 0 taken 232456853 times.
✓ Branch 1 taken 79445328 times.
✓ Branch 2 taken 232456772 times.
✓ Branch 3 taken 81 times.
|
311902181 | if(drunk && drunkstate) ret = !ret; |
| 8922 | 311902181 | return ret; | |
| 8923 | 311902181 | } | |
| 8924 | |||
| 8925 | 15562981 | byte getIntBtnInput(byte intbtn, int input_flags) | |
| 8926 | { | ||
| 8927 | 15562981 | byte ret = 0; | |
| 8928 |
2/2✓ Branch 0 taken 11119281 times.
✓ Branch 1 taken 4443700 times.
|
15562981 | if(intbtn & INT_BTN_A) ret |= getInput(btnA, input_flags) ? INT_BTN_A : 0; |
| 8929 |
2/2✓ Branch 0 taken 15346113 times.
✓ Branch 1 taken 216868 times.
|
15562981 | if(intbtn & INT_BTN_B) ret |= getInput(btnB, input_flags) ? INT_BTN_B : 0; |
| 8930 |
2/2✓ Branch 0 taken 15347431 times.
✓ Branch 1 taken 215550 times.
|
15562981 | if(intbtn & INT_BTN_L) ret |= getInput(btnL, input_flags) ? INT_BTN_L : 0; |
| 8931 |
2/2✓ Branch 0 taken 15347431 times.
✓ Branch 1 taken 215550 times.
|
15562981 | if(intbtn & INT_BTN_R) ret |= getInput(btnR, input_flags) ? INT_BTN_R : 0; |
| 8932 |
2/2✓ Branch 0 taken 15347431 times.
✓ Branch 1 taken 215550 times.
|
15562981 | if(intbtn & INT_BTN_EX1) ret |= getInput(btnEx1, input_flags) ? INT_BTN_EX1 : 0; |
| 8933 |
2/2✓ Branch 0 taken 15347431 times.
✓ Branch 1 taken 215550 times.
|
15562981 | if(intbtn & INT_BTN_EX2) ret |= getInput(btnEx2, input_flags) ? INT_BTN_EX2 : 0; |
| 8934 |
2/2✓ Branch 0 taken 15347431 times.
✓ Branch 1 taken 215550 times.
|
15562981 | if(intbtn & INT_BTN_EX3) ret |= getInput(btnEx3, input_flags) ? INT_BTN_EX3 : 0; |
| 8935 |
2/2✓ Branch 0 taken 15347316 times.
✓ Branch 1 taken 215665 times.
|
15562981 | if(intbtn & INT_BTN_EX4) ret |= getInput(btnEx4, input_flags) ? INT_BTN_EX4 : 0; |
| 8936 | 15562981 | return ret; //No early return, to make sure all button presses are eaten that should be! -Em | |
| 8937 | } | ||
| 8938 | |||
| 8939 | 7513 | byte checkIntBtnVal(byte intbtn, byte vals) | |
| 8940 | { | ||
| 8941 | 7513 | return intbtn&vals; | |
| 8942 | } | ||
| 8943 | |||
| 8944 | 219067 | bool Up() | |
| 8945 | { | ||
| 8946 | 219067 | return getInput(btnUp); | |
| 8947 | } | ||
| 8948 | 219066 | bool Down() | |
| 8949 | { | ||
| 8950 | 219066 | return getInput(btnDown); | |
| 8951 | } | ||
| 8952 | 219066 | bool Left() | |
| 8953 | { | ||
| 8954 | 219066 | return getInput(btnLeft); | |
| 8955 | } | ||
| 8956 | 219066 | bool Right() | |
| 8957 | { | ||
| 8958 | 219066 | return getInput(btnRight); | |
| 8959 | } | ||
| 8960 | 552983 | bool cAbtn() | |
| 8961 | { | ||
| 8962 | 552983 | return getInput(btnA); | |
| 8963 | } | ||
| 8964 | 3375311 | bool cBbtn() | |
| 8965 | { | ||
| 8966 | 3375311 | return getInput(btnB); | |
| 8967 | } | ||
| 8968 | ✗ | bool cSbtn() | |
| 8969 | { | ||
| 8970 | ✗ | return getInput(btnS); | |
| 8971 | } | ||
| 8972 | 218976 | bool cLbtn() | |
| 8973 | { | ||
| 8974 | 218976 | return getInput(btnL); | |
| 8975 | } | ||
| 8976 | 218976 | bool cRbtn() | |
| 8977 | { | ||
| 8978 | 218976 | return getInput(btnR); | |
| 8979 | } | ||
| 8980 | ✗ | bool cPbtn() | |
| 8981 | { | ||
| 8982 | ✗ | return getInput(btnP); | |
| 8983 | } | ||
| 8984 | ✗ | bool cEx1btn() | |
| 8985 | { | ||
| 8986 | ✗ | return getInput(btnEx1); | |
| 8987 | } | ||
| 8988 | ✗ | bool cEx2btn() | |
| 8989 | { | ||
| 8990 | ✗ | return getInput(btnEx2); | |
| 8991 | } | ||
| 8992 | ✗ | bool cEx3btn() | |
| 8993 | { | ||
| 8994 | ✗ | return getInput(btnEx3); | |
| 8995 | } | ||
| 8996 | ✗ | bool cEx4btn() | |
| 8997 | { | ||
| 8998 | ✗ | return getInput(btnEx4); | |
| 8999 | } | ||
| 9000 | ✗ | bool AxisUp() | |
| 9001 | { | ||
| 9002 | ✗ | return getInput(btnAxisUp); | |
| 9003 | } | ||
| 9004 | ✗ | bool AxisDown() | |
| 9005 | { | ||
| 9006 | ✗ | return getInput(btnAxisDown); | |
| 9007 | } | ||
| 9008 | ✗ | bool AxisLeft() | |
| 9009 | { | ||
| 9010 | ✗ | return getInput(btnAxisLeft); | |
| 9011 | } | ||
| 9012 | ✗ | bool AxisRight() | |
| 9013 | { | ||
| 9014 | ✗ | return getInput(btnAxisRight); | |
| 9015 | } | ||
| 9016 | |||
| 9017 | ✗ | bool cMbtn() | |
| 9018 | { | ||
| 9019 | ✗ | return getInput(btnM); | |
| 9020 | } | ||
| 9021 | ✗ | bool cF12() | |
| 9022 | { | ||
| 9023 | ✗ | return getInput(btnF12); | |
| 9024 | } | ||
| 9025 | ✗ | bool cF11() | |
| 9026 | { | ||
| 9027 | ✗ | return getInput(btnF11); | |
| 9028 | } | ||
| 9029 | ✗ | bool cF5() | |
| 9030 | { | ||
| 9031 | ✗ | return getInput(btnF5); | |
| 9032 | } | ||
| 9033 | ✗ | bool cQ() | |
| 9034 | { | ||
| 9035 | ✗ | return getInput(btnQ); | |
| 9036 | } | ||
| 9037 | ✗ | bool cI() | |
| 9038 | { | ||
| 9039 | ✗ | return getInput(btnI); | |
| 9040 | } | ||
| 9041 | |||
| 9042 | 219242 | bool rUp() | |
| 9043 | { | ||
| 9044 | 219242 | return getInput(btnUp, INPUT_PRESS); | |
| 9045 | } | ||
| 9046 | 218990 | bool rDown() | |
| 9047 | { | ||
| 9048 | 218990 | return getInput(btnDown, INPUT_PRESS); | |
| 9049 | } | ||
| 9050 | 218740 | bool rLeft() | |
| 9051 | { | ||
| 9052 | 218740 | return getInput(btnLeft, INPUT_PRESS); | |
| 9053 | } | ||
| 9054 | 217884 | bool rRight() | |
| 9055 | { | ||
| 9056 | 217884 | return getInput(btnRight, INPUT_PRESS); | |
| 9057 | } | ||
| 9058 | 4680 | bool rAbtn() | |
| 9059 | { | ||
| 9060 | 4680 | return getInput(btnA, INPUT_PRESS); | |
| 9061 | } | ||
| 9062 | ✗ | bool rBbtn() | |
| 9063 | { | ||
| 9064 | ✗ | return getInput(btnB, INPUT_PRESS); | |
| 9065 | } | ||
| 9066 | 218266 | bool rSbtn() | |
| 9067 | { | ||
| 9068 | 218266 | return getInput(btnS, INPUT_PRESS); | |
| 9069 | } | ||
| 9070 | 19229703 | bool rMbtn() | |
| 9071 | { | ||
| 9072 | 19229703 | return getInput(btnM, INPUT_PRESS); | |
| 9073 | } | ||
| 9074 | 186046 | bool rLbtn() | |
| 9075 | { | ||
| 9076 | 186046 | return getInput(btnL, INPUT_PRESS); | |
| 9077 | } | ||
| 9078 | 186041 | bool rRbtn() | |
| 9079 | { | ||
| 9080 | 186041 | return getInput(btnR, INPUT_PRESS); | |
| 9081 | } | ||
| 9082 | 218976 | bool rPbtn() | |
| 9083 | { | ||
| 9084 | 218976 | return getInput(btnP, INPUT_PRESS); | |
| 9085 | } | ||
| 9086 | ✗ | bool rEx1btn() | |
| 9087 | { | ||
| 9088 | ✗ | return getInput(btnEx1, INPUT_PRESS); | |
| 9089 | } | ||
| 9090 | ✗ | bool rEx2btn() | |
| 9091 | { | ||
| 9092 | ✗ | return getInput(btnEx2, INPUT_PRESS); | |
| 9093 | } | ||
| 9094 | 186037 | bool rEx3btn() | |
| 9095 | { | ||
| 9096 | 186037 | return getInput(btnEx3, INPUT_PRESS); | |
| 9097 | } | ||
| 9098 | 186037 | bool rEx4btn() | |
| 9099 | { | ||
| 9100 | 186037 | return getInput(btnEx4, INPUT_PRESS); | |
| 9101 | } | ||
| 9102 | ✗ | bool rAxisUp() | |
| 9103 | { | ||
| 9104 | ✗ | return getInput(btnAxisUp, INPUT_PRESS); | |
| 9105 | } | ||
| 9106 | ✗ | bool rAxisDown() | |
| 9107 | { | ||
| 9108 | ✗ | return getInput(btnAxisDown, INPUT_PRESS); | |
| 9109 | } | ||
| 9110 | ✗ | bool rAxisLeft() | |
| 9111 | { | ||
| 9112 | ✗ | return getInput(btnAxisLeft, INPUT_PRESS); | |
| 9113 | } | ||
| 9114 | ✗ | bool rAxisRight() | |
| 9115 | { | ||
| 9116 | ✗ | return getInput(btnAxisRight, INPUT_PRESS); | |
| 9117 | } | ||
| 9118 | |||
| 9119 | ✗ | bool rF11() | |
| 9120 | { | ||
| 9121 | ✗ | return getInput(btnF11, INPUT_PRESS); | |
| 9122 | } | ||
| 9123 | ✗ | bool rQ() | |
| 9124 | { | ||
| 9125 | ✗ | return getInput(btnQ, INPUT_PRESS); | |
| 9126 | } | ||
| 9127 | ✗ | bool rI() | |
| 9128 | { | ||
| 9129 | ✗ | return getInput(btnI, INPUT_PRESS); | |
| 9130 | } | ||
| 9131 | |||
| 9132 | ✗ | bool DrunkUp() | |
| 9133 | { | ||
| 9134 | ✗ | return getInput(btnUp, INPUT_DRUNK); | |
| 9135 | } | ||
| 9136 | ✗ | bool DrunkDown() | |
| 9137 | { | ||
| 9138 | ✗ | return getInput(btnDown, INPUT_DRUNK); | |
| 9139 | } | ||
| 9140 | ✗ | bool DrunkLeft() | |
| 9141 | { | ||
| 9142 | ✗ | return getInput(btnLeft, INPUT_DRUNK); | |
| 9143 | } | ||
| 9144 | ✗ | bool DrunkRight() | |
| 9145 | { | ||
| 9146 | ✗ | return getInput(btnRight, INPUT_DRUNK); | |
| 9147 | } | ||
| 9148 | ✗ | bool DrunkcAbtn() | |
| 9149 | { | ||
| 9150 | ✗ | return getInput(btnA, INPUT_DRUNK); | |
| 9151 | } | ||
| 9152 | ✗ | bool DrunkcBbtn() | |
| 9153 | { | ||
| 9154 | ✗ | return getInput(btnB, INPUT_DRUNK); | |
| 9155 | } | ||
| 9156 | ✗ | bool DrunkcEx1btn() | |
| 9157 | { | ||
| 9158 | ✗ | return getInput(btnEx1, INPUT_DRUNK); | |
| 9159 | } | ||
| 9160 | ✗ | bool DrunkcEx2btn() | |
| 9161 | { | ||
| 9162 | ✗ | return getInput(btnEx2, INPUT_DRUNK); | |
| 9163 | } | ||
| 9164 | ✗ | bool DrunkcSbtn() | |
| 9165 | { | ||
| 9166 | ✗ | return getInput(btnS, INPUT_DRUNK); | |
| 9167 | } | ||
| 9168 | ✗ | bool DrunkcMbtn() | |
| 9169 | { | ||
| 9170 | ✗ | return getInput(btnM, INPUT_DRUNK); | |
| 9171 | } | ||
| 9172 | ✗ | bool DrunkcLbtn() | |
| 9173 | { | ||
| 9174 | ✗ | return getInput(btnL, INPUT_DRUNK); | |
| 9175 | } | ||
| 9176 | ✗ | bool DrunkcRbtn() | |
| 9177 | { | ||
| 9178 | ✗ | return getInput(btnR, INPUT_DRUNK); | |
| 9179 | } | ||
| 9180 | ✗ | bool DrunkcPbtn() | |
| 9181 | { | ||
| 9182 | ✗ | return getInput(btnP, INPUT_DRUNK); | |
| 9183 | } | ||
| 9184 | |||
| 9185 | ✗ | bool DrunkrUp() | |
| 9186 | { | ||
| 9187 | ✗ | return getInput(btnUp, INPUT_PRESS | INPUT_DRUNK); | |
| 9188 | } | ||
| 9189 | ✗ | bool DrunkrDown() | |
| 9190 | { | ||
| 9191 | ✗ | return getInput(btnDown, INPUT_PRESS | INPUT_DRUNK); | |
| 9192 | } | ||
| 9193 | ✗ | bool DrunkrLeft() | |
| 9194 | { | ||
| 9195 | ✗ | return getInput(btnLeft, INPUT_PRESS | INPUT_DRUNK); | |
| 9196 | } | ||
| 9197 | ✗ | bool DrunkrRight() | |
| 9198 | { | ||
| 9199 | ✗ | return getInput(btnRight, INPUT_PRESS | INPUT_DRUNK); | |
| 9200 | } | ||
| 9201 | ✗ | bool DrunkrAbtn() | |
| 9202 | { | ||
| 9203 | ✗ | return getInput(btnA, INPUT_PRESS | INPUT_DRUNK); | |
| 9204 | } | ||
| 9205 | ✗ | bool DrunkrBbtn() | |
| 9206 | { | ||
| 9207 | ✗ | return getInput(btnB, INPUT_PRESS | INPUT_DRUNK); | |
| 9208 | } | ||
| 9209 | ✗ | bool DrunkrEx1btn() | |
| 9210 | { | ||
| 9211 | ✗ | return getInput(btnEx1, INPUT_PRESS | INPUT_DRUNK); | |
| 9212 | } | ||
| 9213 | ✗ | bool DrunkrEx2btn() | |
| 9214 | { | ||
| 9215 | ✗ | return getInput(btnEx2, INPUT_PRESS | INPUT_DRUNK); | |
| 9216 | } | ||
| 9217 | ✗ | bool DrunkrEx3btn() | |
| 9218 | { | ||
| 9219 | ✗ | return getInput(btnEx3, INPUT_PRESS | INPUT_DRUNK); | |
| 9220 | } | ||
| 9221 | ✗ | bool DrunkrEx4btn() | |
| 9222 | { | ||
| 9223 | ✗ | return getInput(btnEx4, INPUT_PRESS | INPUT_DRUNK); | |
| 9224 | } | ||
| 9225 | ✗ | bool DrunkrSbtn() | |
| 9226 | { | ||
| 9227 | ✗ | return getInput(btnS, INPUT_PRESS | INPUT_DRUNK); | |
| 9228 | } | ||
| 9229 | ✗ | bool DrunkrMbtn() | |
| 9230 | { | ||
| 9231 | ✗ | return getInput(btnM, INPUT_PRESS | INPUT_DRUNK); | |
| 9232 | } | ||
| 9233 | ✗ | bool DrunkrLbtn() | |
| 9234 | { | ||
| 9235 | ✗ | return getInput(btnL, INPUT_PRESS | INPUT_DRUNK); | |
| 9236 | } | ||
| 9237 | ✗ | bool DrunkrRbtn() | |
| 9238 | { | ||
| 9239 | ✗ | return getInput(btnR, INPUT_PRESS | INPUT_DRUNK); | |
| 9240 | } | ||
| 9241 | ✗ | bool DrunkrPbtn() | |
| 9242 | { | ||
| 9243 | ✗ | return getInput(btnP, INPUT_PRESS | INPUT_DRUNK); | |
| 9244 | } | ||
| 9245 | |||
| 9246 | 19269 | void eat_buttons() | |
| 9247 | { | ||
| 9248 | 19269 | getInput(btnA, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9249 | 19269 | getInput(btnB, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9250 | 19269 | getInput(btnS, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9251 | 19269 | getInput(btnM, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9252 | 19269 | getInput(btnL, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9253 | 19269 | getInput(btnR, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9254 | 19269 | getInput(btnP, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9255 | 19269 | getInput(btnEx1, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9256 | 19269 | getInput(btnEx2, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9257 | 19269 | getInput(btnEx3, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9258 | 19269 | getInput(btnEx4, INPUT_PRESS | INPUT_IGNORE_DISABLE); | |
| 9259 | 19269 | } | |
| 9260 | |||
| 9261 | // Is true for the _first frame_ of a key press. | ||
| 9262 | // But! it is possible that a script manually sets the value of KeyPress, | ||
| 9263 | // in which case it will be restored to the "true" value based on `key_current_frame` | ||
| 9264 | // and `key_previous_frame` on the next frame. | ||
| 9265 | 59 | bool zc_readkey(int32_t k, bool ignoreDisable) | |
| 9266 | { | ||
| 9267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | if(ignoreDisable) return KeyPress[k]; |
| 9268 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
|
59 | switch(k) |
| 9269 | { | ||
| 9270 | case KEY_F7: | ||
| 9271 | case KEY_F8: | ||
| 9272 | case KEY_F9: | ||
| 9273 | ✗ | return KeyPress[k]; | |
| 9274 | |||
| 9275 | default: | ||
| 9276 |
2/2✓ Branch 0 taken 47 times.
✓ Branch 1 taken 12 times.
|
59 | return KeyPress[k] && !disabledKeys[k]; |
| 9277 | } | ||
| 9278 | 59 | } | |
| 9279 | |||
| 9280 | // Is true for _every frame_ a key is held down. | ||
| 9281 | // But! it is possible that a script manually sets the value of KeyInput, | ||
| 9282 | // in which case it will be restored to the "true" value based on `key_current_frame` | ||
| 9283 | // on the next frame. | ||
| 9284 | ✗ | bool zc_getkey(int32_t k, bool ignoreDisable) | |
| 9285 | { | ||
| 9286 | ✗ | if(ignoreDisable) return KeyInput[k]; | |
| 9287 | ✗ | switch(k) | |
| 9288 | { | ||
| 9289 | case KEY_F7: | ||
| 9290 | case KEY_F8: | ||
| 9291 | case KEY_F9: | ||
| 9292 | ✗ | return KeyInput[k]; | |
| 9293 | |||
| 9294 | default: | ||
| 9295 | ✗ | return KeyInput[k] && !disabledKeys[k]; | |
| 9296 | } | ||
| 9297 | ✗ | } | |
| 9298 | |||
| 9299 | // Reads (and then clears) the current frame key state directly. | ||
| 9300 | // Scripts can also modify `key_current_frame`. | ||
| 9301 | 954 | bool zc_readrawkey(int32_t k, bool ignoreDisable) | |
| 9302 | { | ||
| 9303 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 950 times.
|
954 | if(zc_getrawkey(k, ignoreDisable)) |
| 9304 | { | ||
| 9305 | 4 | _key[k]=key[k]=key_current_frame[k]=0; | |
| 9306 | 4 | return true; | |
| 9307 | } | ||
| 9308 | 950 | _key[k]=key[k]=key_current_frame[k]=0; | |
| 9309 | 950 | return false; | |
| 9310 | 954 | } | |
| 9311 | |||
| 9312 | // Reads the current frame key state directly. | ||
| 9313 | // Scripts can also modify `key_current_frame`. | ||
| 9314 | 130182427 | bool zc_getrawkey(int32_t k, bool ignoreDisable) | |
| 9315 | { | ||
| 9316 |
2/2✓ Branch 0 taken 110952606 times.
✓ Branch 1 taken 19229821 times.
|
130182427 | if(ignoreDisable) return key_current_frame[k]; |
| 9317 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19229821 times.
|
19229821 | switch(k) |
| 9318 | { | ||
| 9319 | case KEY_F7: | ||
| 9320 | case KEY_F8: | ||
| 9321 | case KEY_F9: | ||
| 9322 | ✗ | return key_current_frame[k]; | |
| 9323 | |||
| 9324 | default: | ||
| 9325 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19229821 times.
|
19229821 | return key_current_frame[k] && !disabledKeys[k]; |
| 9326 | } | ||
| 9327 | 130182427 | } | |
| 9328 | |||
| 9329 | // Only used for a handful of keys, like tilde and Function keys. | ||
| 9330 | // This state is never read within the game. | ||
| 9331 | // It exists so that all keyboard input still functions during replay, | ||
| 9332 | // without inadvertently doing things like toggling throttling if the player | ||
| 9333 | // presses ~ | ||
| 9334 | ✗ | bool zc_get_system_key(int32_t k) | |
| 9335 | { | ||
| 9336 | ✗ | return key_system[k]; | |
| 9337 | } | ||
| 9338 | |||
| 9339 | // True for the _first_ frame of a key press. | ||
| 9340 | 173067327 | bool zc_read_system_key(int32_t k) | |
| 9341 | { | ||
| 9342 | 173067327 | return key_system_press[k]; | |
| 9343 | } | ||
| 9344 | |||
| 9345 | 2442172281 | bool is_system_key(int32_t k) | |
| 9346 | { | ||
| 9347 |
2/2✓ Branch 0 taken 2269104954 times.
✓ Branch 1 taken 173067327 times.
|
2442172281 | switch (k) |
| 9348 | { | ||
| 9349 | case KEY_BACKQUOTE: | ||
| 9350 | case KEY_CLOSEBRACE: | ||
| 9351 | case KEY_END: | ||
| 9352 | case KEY_HOME: | ||
| 9353 | case KEY_OPENBRACE: | ||
| 9354 | case KEY_PGDN: | ||
| 9355 | case KEY_PGUP: | ||
| 9356 | case KEY_TAB: | ||
| 9357 | case KEY_TILDE: | ||
| 9358 | 173067327 | return true; | |
| 9359 | } | ||
| 9360 | 2269104954 | return is_Fkey(k); | |
| 9361 | 2442172281 | } | |
| 9362 | |||
| 9363 | 19229703 | void update_system_keys() | |
| 9364 | { | ||
| 9365 |
2/2✓ Branch 0 taken 2442172281 times.
✓ Branch 1 taken 19229703 times.
|
2461401984 | for (int32_t q = 0; q < 127; ++q) |
| 9366 | { | ||
| 9367 |
2/2✓ Branch 0 taken 403823763 times.
✓ Branch 1 taken 2038348518 times.
|
2442172281 | if (!is_system_key(q)) |
| 9368 | 2038348518 | continue; | |
| 9369 | |||
| 9370 | 403823763 | key_system[q] = key[q]; | |
| 9371 |
1/2✓ Branch 0 taken 403823763 times.
✗ Branch 1 not taken.
|
403823763 | key_system_press[q] = key_system[q] && !key_system_previous[q]; |
| 9372 | 403823763 | key_system_previous[q] = key_system[q]; | |
| 9373 | 403823763 | } | |
| 9374 | 19229703 | } | |
| 9375 | |||
| 9376 | 20569645 | void update_keys() | |
| 9377 | { | ||
| 9378 |
2/2✓ Branch 0 taken 2612344915 times.
✓ Branch 1 taken 20569645 times.
|
2632914560 | for (int32_t q = 0; q < 127; ++q) |
| 9379 | { | ||
| 9380 | // When replaying, replay.cpp takes care of updating `key_current_frame`. | ||
| 9381 |
2/2✓ Branch 0 taken 2612332215 times.
✓ Branch 1 taken 12700 times.
|
2612344915 | if (!replay_is_replaying()) |
| 9382 | 12700 | key_current_frame[q] = key[q]; | |
| 9383 | |||
| 9384 |
2/2✓ Branch 0 taken 2592244385 times.
✓ Branch 1 taken 20100530 times.
|
2612344915 | KeyPress[q] = key_current_frame[q] && !key_previous_frame[q]; |
| 9385 | 2612344915 | KeyInput[q] = key_current_frame[q]; | |
| 9386 | 2612344915 | key_previous_frame[q] = key_current_frame[q]; | |
| 9387 | 2612344915 | } | |
| 9388 | 20569645 | } | |
| 9389 | |||
| 9390 |